1. Marcin Kuzminski
  2. RhodeCode
  3. Issues

Issues

Issue #253 duplicate

Can't reconnect until invalid transaction is rolled back

striker69
created an issue

I got a lot of these errors and I had to restart our Apache server to solve it.

{{{

!python

URL: https://mercurial/CES?cmd=capabilities Module weberror.errormiddleware:162 in call

app_iter = self.application(environ, sr_checker) Module rhodecode.lib.middleware.simplegit:108 in call return self.application(environ, start_response) Module rhodecode.lib.middleware.simplehg:104 in call repo_name) Module rhodecode.lib.middleware.simplehg:211 in check_permission repo_name): Module rhodecode.lib.auth:595 in call usr = AuthUser(user.user_id) Module rhodecode.lib.auth:251 in init self.propagate_data() Module rhodecode.lib.auth:275 in propagate_data user_model.fill_perms(self) Module rhodecode.model.user:277 in fill_perms .filter(RepoToPerm.user == default_user).all() Module sqlalchemy.orm.query:1729 in all return list(self) Module rhodecode.model.caching_query:82 in iter return Query.iter(self) Module sqlalchemy.orm.query:1839 in iter__ return self._execute_and_instances(context) Module sqlalchemy.orm.query:1854 in _execute_and_instances result = conn.execute(querycontext.statement, self._params) Module sqlalchemy.engine.base:1399 in execute params) Module sqlalchemy.engine.base:1532 in _execute_clauseelement compiled_sql, distilled_params Module sqlalchemy.engine.base:1599 in _execute_context None, None) Module sqlalchemy.engine.base:1593 in _execute_context conn = self._revalidate_connection() Module sqlalchemy.engine.base:1018 in _revalidate_connection "Can't reconnect until invalid " StatementError: Can't reconnect until invalid transaction is rolled back (original cause: InvalidRequestError: Can't reconnect until invalid transaction is rolled back) 'SELECT repo_to_perm.repo_to_perm_id AS repo_to_perm_repo_to_perm_id, repo_to_perm.user_id AS repo_to_perm_user_id, repo_to_perm.permission_id AS repo_to_perm_permission_id, repo_to_perm.repository_id AS repo_to_perm_repository_id, repositories.statistics AS repositories_statistics, repositories.downloads AS repositories_downloads, repositories.repo_id AS repositories_repo_id, repositories.repo_name AS repositories_repo_name, repositories.clone_uri AS repositories_clone_uri, repositories.repo_type AS repositories_repo_type, repositories.user_id AS repositories_user_id, repositories.private AS repositories_private, repositories.description AS repositories_description, repositories.created_on AS repositories_created_on, repositories.fork_id AS repositories_fork_id, repositories.group_id AS repositories_group_id, permissions.permission_id AS permissions_permission_id, permissions.permission_name AS permissions_permission_name, permissions.permission_longname AS permissions_permission_longname \nFROM repo_to_perm INNER JOIN repositories ON repo_to_perm.repository_id = repositories.repo_id INNER JOIN permissions ON repo_to_perm.permission_id = permissions.permission_id \nWHERE %s = repo_to_perm.user_id' [immutabledict({})] CGI Variables DOCUMENT_ROOT '/var/www/' GATEWAY_INTERFACE 'CGI/1.1' HTTPS '1' HTTP_ACCEPT 'application/mercurial-0.1' HTTP_ACCEPT_ENCODING 'identity' HTTP_AUTHORIZATION 'Basic XXXXXXXXXXXXXX' HTTP_HOST 'mercurial' HTTP_USER_AGENT 'mercurial/proto-1.0' HTTP_X_URL_SCHEME 'https' PATH_INFO '/Repo' PATH_TRANSLATED '/devtools/InternalTools/rhodecode/hg.wsgi/Repo' QUERY_STRING 'cmd=capabilities' REMOTE_ADDR '192.168.64.149' REMOTE_PORT '50789' REPO_NAME 'Repo' REQUEST_METHOD 'GET' REQUEST_URI '/Repo?cmd=capabilities' SCRIPT_FILENAME '/devtools/InternalTools/rhodecode/hg.wsgi' SCRIPT_URI 'https://mercurial/Repo' SCRIPT_URL '/Repo' SERVER_ADDR '192.168.64.78' SERVER_ADMIN '[no address given]' SERVER_NAME 'mercurial' SERVER_PORT '443' SERVER_PROTOCOL 'HTTP/1.1' SERVER_SIGNATURE '<address>Apache/2.2.16 (Debian) Server at mercurial Port 443</address>\n' SERVER_SOFTWARE 'Apache/2.2.16 (Debian)' WSGI Variables application <rhodecode.lib.middleware.simplegit.SimpleGit object at 0x7f8832aed750> mod_wsgi.application_group 'hg' mod_wsgi.callable_object 'application' mod_wsgi.handler_script '' mod_wsgi.input_chunked '0' mod_wsgi.listener_host '' mod_wsgi.listener_port '443' mod_wsgi.process_group 'hg' mod_wsgi.request_handler 'wsgi-script' mod_wsgi.script_reloading '1' mod_wsgi.version (3, 3) paste.parsed_querystring ([('cmd', 'capabilities')], 'cmd=capabilities') paste.registry <paste.registry.Registry object at 0x7f8801230e10> paste.throw_errors True pylons.status_code_redirect True wsgi process 'Multi process AND threads (?)' wsgi.file_wrapper <built-in method file_wrapper of mod_wsgi.Adapter object at 0x7f880120ab70> wsgi.version (1, 1)

}}}

Before getting these errors, I got this one:

{{{

!python

URL: https://mercurial/Repo?cmd=capabilities Module weberror.errormiddleware:162 in call

app_iter = self.application(environ, sr_checker) Module rhodecode.lib.middleware.simplegit:108 in call return self.application(environ, start_response) Module rhodecode.lib.middleware.simplehg:104 in call repo_name) Module rhodecode.lib.middleware.simplehg:211 in check_permission repo_name): Module rhodecode.lib.auth:595 in call usr = AuthUser(user.user_id) Module rhodecode.lib.auth:251 in init self.propagate_data() Module rhodecode.lib.auth:275 in propagate_data user_model.fill_perms(self) Module rhodecode.model.user:277 in fill_perms .filter(RepoToPerm.user == default_user).all() Module sqlalchemy.orm.query:1729 in all return list(self) Module rhodecode.model.caching_query:82 in iter return Query.iter(self) Module sqlalchemy.orm.query:1839 in iter__ return self._execute_and_instances(context) Module sqlalchemy.orm.query:1854 in _execute_and_instances result = conn.execute(querycontext.statement, self._params) Module sqlalchemy.engine.base:1399 in execute params) Module sqlalchemy.engine.base:1532 in _execute_clauseelement compiled_sql, distilled_params Module sqlalchemy.engine.base:1640 in _execute_context context) Module sqlalchemy.engine.base:1633 in _execute_context context) Module sqlalchemy.engine.default:325 in do_execute cursor.execute(statement, parameters) Module MySQLdb.cursors:166 in execute self.errorhandler(self, exc, value) Module MySQLdb.connections:35 in defaulterrorhandler raise errorclass, errorvalue OperationalError: (OperationalError) (2006, 'MySQL server has gone away') 'SELECT repo_to_perm.repo_to_perm_id AS repo_to_perm_repo_to_perm_id, repo_to_perm.user_id AS repo_to_perm_user_id, repo_to_perm.permission_id AS repo_to_perm_permission_id, repo_to_perm.repository_id AS repo_to_perm_repository_id, repositories.statistics AS repositories_statistics, repositories.downloads AS repositories_downloads, repositories.repo_id AS repositories_repo_id, repositories.repo_name AS repositories_repo_name, repositories.clone_uri AS repositories_clone_uri, repositories.repo_type AS repositories_repo_type, repositories.user_id AS repositories_user_id, repositories.private AS repositories_private, repositories.description AS repositories_description, repositories.created_on AS repositories_created_on, repositories.fork_id AS repositories_fork_id, repositories.group_id AS repositories_group_id, permissions.permission_id AS permissions_permission_id, permissions.permission_name AS permissions_permission_name, permissions.permission_longname AS permissions_permission_longname \nFROM repo_to_perm INNER JOIN repositories ON repo_to_perm.repository_id = repositories.repo_id INNER JOIN permissions ON repo_to_perm.permission_id = permissions.permission_id \nWHERE %s = repo_to_perm.user_id' (1L,) CGI Variables DOCUMENT_ROOT '/var/www/' GATEWAY_INTERFACE 'CGI/1.1' HTTPS '1' HTTP_ACCEPT 'application/mercurial-0.1' HTTP_ACCEPT_ENCODING 'identity' HTTP_AUTHORIZATION 'Basic XXX' HTTP_HOST 'mercurial' HTTP_USER_AGENT 'mercurial/proto-1.0' HTTP_X_URL_SCHEME 'https' PATH_INFO '/Repo' PATH_TRANSLATED '/devtools/InternalTools/rhodecode/hg.wsgi/Repo' QUERY_STRING 'cmd=capabilities' REMOTE_ADDR '192.168.64.149' REMOTE_PORT '65188' REPO_NAME 'Repo' REQUEST_METHOD 'GET' REQUEST_URI '/Repo?cmd=capabilities' SCRIPT_FILENAME '/devtools/InternalTools/rhodecode/hg.wsgi' SCRIPT_URI 'https://mercurial/Repo' SCRIPT_URL '/Repo' SERVER_ADDR '192.168.64.78' SERVER_ADMIN '[no address given]' SERVER_NAME 'mercurial' SERVER_PORT '443' SERVER_PROTOCOL 'HTTP/1.1' SERVER_SIGNATURE '<address>Apache/2.2.16 (Debian) Server at mercurial Port 443</address>\n' SERVER_SOFTWARE 'Apache/2.2.16 (Debian)' WSGI Variables application <rhodecode.lib.middleware.simplegit.SimpleGit object at 0x7f8832aed750> mod_wsgi.application_group 'hg' mod_wsgi.callable_object 'application' mod_wsgi.handler_script '' mod_wsgi.input_chunked '0' mod_wsgi.listener_host '' mod_wsgi.listener_port '443' mod_wsgi.process_group 'hg' mod_wsgi.request_handler 'wsgi-script' mod_wsgi.script_reloading '1' mod_wsgi.version (3, 3) paste.parsed_querystring ([('cmd', 'capabilities')], 'cmd=capabilities') paste.registry <paste.registry.Registry object at 0x7f8809857490> paste.throw_errors True pylons.status_code_redirect True wsgi process 'Multi process AND threads (?)' wsgi.file_wrapper <built-in method file_wrapper of mod_wsgi.Adapter object at 0x7f8801f656c0> wsgi.version (1, 1)

}}}

Any idea on this one?

Comments (4)

  1. Xiao Meng

    you must write your commit code formally, like:

    try:
        session.commit()
    except:
        session.rollback()
    

    or the conflicts between pre-used session and new connected session will cause that error.

  2. Log in to comment