graphql-python / graphql-core-legacy

GraphQL base implementation for Python (legacy version – see graphql-core for the current one)
MIT License
374 stars 183 forks source link

sqlalchemy.exc.InvalidRequestError: Can't reconnect until invalid transaction is rolled back #122

Open bochuxt opened 7 years ago

bochuxt commented 7 years ago

i get the following error, it lost connection once a while and not able to reconnect.

sqlalchemy.exc.InvalidRequestError: Can't reconnect until invalid transaction is rolled back

2017-05-25 21:20:40 +0000] [1034] [DEBUG] Closing connection. [2017-05-25 21:20:42 +0000] [1034] [DEBUG] GET /graphiql [2017-05-25 21:20:42 +0000] [1034] [DEBUG] Closing connection. [2017-05-25 21:20:42 +0000] [1032] [DEBUG] GET /graphiql/graphiql.css [2017-05-25 21:20:42 +0000] [1033] [DEBUG] GET /graphiql/graphiql.min.js [2017-05-25 21:20:42 +0000] [1032] [DEBUG] Closing connection. [2017-05-25 21:20:42 +0000] [1033] [DEBUG] Closing connection. [2017-05-25 21:20:44 +0000] [1033] [DEBUG] POST /graphql [2017-05-25 21:20:44 +0000] [1033] [DEBUG] Closing connection. [2017-05-25 21:20:48 +0000] [1034] [DEBUG] POST /graphql ERROR:graphql.execution.executor:An error occurred while resolving field Query.focusInCoworkerById Traceback (most recent call last): File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1112, in _execute_context conn = self.__connection AttributeError: 'Connection' object has no attribute '_Connection__connection'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1114, in _execute_context conn = self._revalidate_connection() File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 424, in _revalidate_connection "Can't reconnect until invalid " sqlalchemy.exc.InvalidRequestError: Can't reconnect until invalid transaction is rolled back

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/app/venv3/lib/python3.4/site-packages/graphql/execution/executor.py", line 200, in resolve_or_error return executor.execute(resolve_fn, source, args, context, info) File "/app/venv3/lib/python3.4/site-packages/graphql/execution/executors/sync.py", line 7, in execute return fn(*args, **kwargs) File "/app/ql/dao/schema.py", line 340, in resolve_focusInCoworkerById return queryfocusInCoworker.filter_by(hubot_id=args.get('coworker_id')).all() File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 2703, in all return list(self) File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 2855, in iter return self._execute_and_instances(context) File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 2878, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 945, in execute return meth(self, multiparams, params) File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement compiled_sql, distilled_params File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1121, in _execute_context None, None) File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception exc_info File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 186, in reraise raise value.with_traceback(tb) File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1114, in _execute_context conn = self._revalidate_connection() File "/app/venv3/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 424, in _revalidate_connection "Can't reconnect until invalid " sqlalchemy.exc.StatementError: (sqlalchemy.exc.InvalidRequestError) Can't reconnect until invalid transaction is rolled back [SQL: 'SELECT dashboard_hubot_vitals.id AS dashboard_hubot_vitals_id, dashboard_hubot_vitals.vital_id AS dashboard_hubot_vitals_vital_id, dashboard_hubot_vitals.hubot_id AS dashboard_hubot_vitals_hubot_id \nFROM dashboard_hubot_vitals \nWHERE dashboard_hubot_vitals.hubot_id = %s'] [parameters: [{}]] [2017-05-25 21:20:48 +0000] [1034] [DEBUG] Closing connection. [2017-05-25 21:20:49 +0000] [1032] [DEBUG] POST /graphql

Arlus commented 6 years ago

I'm experiencing the same issue.

jkimbo commented 6 years ago

This looks like an issue in sqlalchemy not in graphql