Neutron-Server Database Not Sync-UP - openstack
I've tried to install a Openstack cluster. After completing Keystone,Nova, I got an issue with Neutron-Server in Database sync-up step as below.
root#controller:/etc/neutron# su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf \
> --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
Running upgrade for neutron ...
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade 63fd95af7dcd -> c613d0b82681
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1246, in _execute_context
cursor, statement, parameters, context
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 581, in do_execute
cursor.execute(statement, parameters)
File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 165, in execute
result = self._query(query)
File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 321, in _query
conn.query(q)
File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 860, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1061, in _read_query_result
result.read()
File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1349, in read
first_packet = self.connection._read_packet()
File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1018, in _read_packet
packet.check_error()
File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 384, in check_error
err.raise_mysql_exception(self._data)
File "/usr/lib/python3/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.InternalError: (1832, "Cannot change column 'network_id': used in a foreign key constraint 'subnets_ibfk_1'")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/neutron-db-manage", line 10, in <module>
sys.exit(main())
File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 658, in main
return_val |= bool(CONF.command.func(config, CONF.command.name))
File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 182, in do_upgrade
desc=branch, sql=CONF.command.sql)
File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 83, in do_alembic_command
getattr(alembic_command, cmd)(config, *args, **kwargs)
File "/usr/lib/python3/dist-packages/alembic/command.py", line 279, in upgrade
script.run_env()
File "/usr/lib/python3/dist-packages/alembic/script/base.py", line 475, in run_env
util.load_python_file(self.dir, "env.py")
File "/usr/lib/python3/dist-packages/alembic/util/pyfiles.py", line 98, in load_python_file
module = load_module_py(module_id, path)
File "/usr/lib/python3/dist-packages/alembic/util/compat.py", line 174, in load_module_py
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/env.py", line 120, in <module>
run_migrations_online()
File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/env.py", line 114, in run_migrations_online
context.run_migrations()
File "<string>", line 8, in run_migrations
File "/usr/lib/python3/dist-packages/alembic/runtime/environment.py", line 846, in run_migrations
self.get_context().run_migrations(**kw)
File "/usr/lib/python3/dist-packages/alembic/runtime/migration.py", line 365, in run_migrations
step.migration_fn(**kw)
File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/versions/train/expand/c613d0b82681_subnet_force_network_id.py", line 40, in upgrade
existing_type=sa.String(36))
File "<string>", line 8, in alter_column
File "<string>", line 3, in alter_column
File "/usr/lib/python3/dist-packages/alembic/operations/ops.py", line 1775, in alter_column
return operations.invoke(alt)
File "/usr/lib/python3/dist-packages/alembic/operations/base.py", line 345, in invoke
return fn(self, operation)
File "/usr/lib/python3/dist-packages/alembic/operations/toimpl.py", line 56, in alter_column
**operation.kw
File "/usr/lib/python3/dist-packages/alembic/ddl/mysql.py", line 98, in alter_column
else existing_comment,
File "/usr/lib/python3/dist-packages/alembic/ddl/impl.py", line 134, in _exec
return conn.execute(construct, *multiparams, **params)
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 982, in execute
return meth(self, multiparams, params)
File "/usr/lib/python3/dist-packages/sqlalchemy/sql/ddl.py", line 72, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1044, in _execute_ddl
compiled,
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1250, in _execute_context
e, statement, parameters, cursor, context
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1474, in _handle_dbapi_exception
util.raise_from_cause(newraise, exc_info)
File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 152, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1246, in _execute_context
cursor, statement, parameters, context
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 581, in do_execute
cursor.execute(statement, parameters)
File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 165, in execute
result = self._query(query)
File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 321, in _query
conn.query(q)
File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 860, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1061, in _read_query_result
result.read()
File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1349, in read
first_packet = self.connection._read_packet()
File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1018, in _read_packet
packet.check_error()
File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 384, in check_error
err.raise_mysql_exception(self._data)
File "/usr/lib/python3/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
raise errorclass(errno, errval)
oslo_db.exception.DBError: (pymysql.err.InternalError) (1832, "Cannot change column 'network_id': used in a foreign key constraint 'subnets_ibfk_1'")
[SQL: ALTER TABLE subnets MODIFY network_id VARCHAR(36) NOT NULL]
(Background on this error at: http://sqlalche.me/e/2j85)
root#controller:/etc/neutron#
Then check neutron-server log, I saw that 'neutron.subnet_dns_publish_fixed_ips' table does not be created successully.
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.146 5355 ERROR neutron.agent.dhcp.agent
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent [req-fc8e970a-8bf9-485d-9716-85d76a0d60bc - - - - -] Unable to sync network state.: oslo_messaging.rpc.client.RemoteError: Remote error: ProgrammingError (pymysql.err.ProgrammingError) (1146, "Table 'neutron.subnet_dns_publish_fixed_ips' doesn't exist")
/var/log/neutron/neutron-dhcp-agent.log:(Background on this error at: http://sqlalche.me/e/f405)
/var/log/neutron/neutron-dhcp-agent.log:['Traceback (most recent call last):\n', ' File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1246, in _execute_context\n cursor, statement, parameters, context\n', ' File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 581, in do_execute\n cursor.execute(statement, parameters)\n', ' File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 165, in execute\n result = self._query(query)\n', ' File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 321, in _query\n conn.query(q)\n', ' File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 860, in query\n self._affected_rows = self._read_query_result(unbuffered=unbuffered)\n', ' File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1061, in _read_query_result\n result.read()\n', ' File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1349, in read\n first_packet = self.connection._read_packet()\n', ' File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1018, in _read_packet\n packet.check_error()\n', ' File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 384, in check_error\n err.raise_mysql_exception(self._data)\n', ' File "/usr/lib/python3/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception\n raise errorclass(errno, errval)\n', 'pymysql.err.ProgrammingError: (1146, "Table \'neutron.subnet_dns_publish_fixed_ips\' doesn\'t exist")\n', '\nThe above exception was the direct cause of the following exception:\n\n', 'Traceback (most recent call last):\n', ' File "/usr/lib/python3/dist-packages/oslo_messaging/rpc/server.py", line 165, in _process_incoming\n res = self.dispatcher.dispatch(message)\n', ' File "/usr/lib/python3/dist-packages/oslo_messaging/rpc/dispatcher.py", line 276, in dispatch\n return self._do_dispatch(endpoint, method, ctxt, args)\n', ' File "/usr/lib/python3/dist-packages/oslo_messaging/rpc/dispatcher.py", line 196, in _do_dispatch\n result = func(ctxt, **new_args)\n', ' File "/usr/lib/python3/dist-packages/neutron/api/rpc/handlers/dhcp_rpc.py", line 143, in get_active_networks_info\n networks = self._get_active_networks(context, **kwargs)\n', ' File "/usr/lib/python3/dist-packages/neutron/api/rpc/handlers/dhcp_rpc.py", line 87, in _get_active_networks\n plugin.auto_schedule_networks(context, host)\n', ' File "/usr/lib/python3/dist-packages/neutron/db/agentschedulers_db.py", line 492, in auto_schedule_networks\n self.network_scheduler.auto_schedule_networks(self, context, host)\n', ' File "/usr/lib/python3/dist-packages/neutron/scheduler/dhcp_agent_scheduler.py", line 50, in auto_schedule_networks\n subnets = plugin.get_subnets(context, fields=fields)\n', ' File "/usr/lib/python3/dist-packages/neutron_lib/db/api.py", line 233, in wrapped\n return method(*args, **kwargs)\n', ' File "/usr/lib/python3/dist-packages/neutron/db/db_base_plugin_v2.py", line 1078, in get_subnets\n marker, page_reverse)\n', ' File "/usr/lib/python3/dist-packages/neutron/db/db_base_plugin_common.py", line 320, in _get_subnets\n **filters)\n', ' File "/usr/lib/python3/dist-packages/neutron/objects/base.py", line 640, in get_objects\n cls, context, _pager=_pager, **cls.modify_fields_to_db(kwargs))\n', ' File "/usr/lib/python3/dist-packages/neutron/objects/db/api.py", line 52, in get_objects\n **(_pager.to_kwargs(context, obj_cls) if _pager else {}))\n', ' File "/usr/lib/python3/dist-packages/neutron_lib/db/model_query.py", line 317, in get_collection\n for c in query\n', ' File "/usr/lib/python3/dist-packages/sqlalchemy/orm/query.py", line 3367, in __iter__\n return self._execute_and_instances(context)\n', ' File "/usr/lib/python3/dist-packages/sqlalchemy/orm/query.py", line 3392, in _execute_and_instances\n result = conn.execute(querycontext.statement, self._params)\n', ' File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 982, in execute\n return meth(self, multiparams, params)\n', ' File "/usr/lib/python3/dist-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection\n return connection._execute_clauseelement(self, multiparams, params)\n', ' File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1101, in _execute_clauseelement\n distilled_params,\n', ' File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1250, in _execute_context\n e, statement, parameters, cursor, context\n', ' File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1474, in _handle_dbapi_exception\n util.raise_from_cause(newraise, exc_info)\n', ' File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause\n reraise(type(exception), exception, tb=exc_tb, cause=cause)\n', ' File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 152, in reraise\n raise value.with_traceback(tb)\n', ' File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1246, in _execute_context\n cursor, statement, parameters, context\n', ' File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 581, in do_execute\n cursor.execute(statement, parameters)\n', ' File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 165, in execute\n result = self._query(query)\n', ' File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 321, in _query\n conn.query(q)\n', ' File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 860, in query\n self._affected_rows = self._read_query_result(unbuffered=unbuffered)\n', ' File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1061, in _read_query_result\n result.read()\n', ' File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1349, in read\n first_packet = self.connection._read_packet()\n', ' File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1018, in _read_packet\n packet.check_error()\n', ' File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 384, in check_error\n err.raise_mysql_exception(self._data)\n', ' File "/usr/lib/python3/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception\n raise errorclass(errno, errval)\n', 'sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError) (1146, "Table \'neutron.subnet_dns_publish_fixed_ips\' doesn\'t exist")\n[SQL: SELECT subnets.project_id AS subnets_project_id, subnets.id AS subnets_id, subnets.in_use AS subnets_in_use, subnets.name AS subnets_name, subnets.network_id AS subnets_network_id, subnets.segment_id AS subnets_segment_id, subnets.subnetpool_id AS subnets_subnetpool_id, subnets.ip_version AS subnets_ip_version, subnets.cidr AS subnets_cidr, subnets.gateway_ip AS subnets_gateway_ip, subnets.enable_dhcp AS subnets_enable_dhcp, subnets.ipv6_ra_mode AS subnets_ipv6_ra_mode, subnets.ipv6_address_mode AS subnets_ipv6_address_mode, subnets.standard_attr_id AS subnets_standard_attr_id, subnetpools_1.shared AS subnetpools_1_shared, standardattributes_1.id AS standardattributes_1_id, standardattributes_1.resource_type AS standardattributes_1_resource_type, standardattributes_1.description AS standardattributes_1_description, standardattributes_1.revision_number AS standardattributes_1_revision_number, standardattributes_1.created_at AS standardattributes_1_created_at, standardattributes_1.updated_at AS standardattributes_1_updated_at, subnetpools_1.project_id AS subnetpools_1_project_id, subnetpools_1.id AS subnetpools_1_id, subnetpools_1.name AS subnetpools_1_name, subnetpools_1.ip_version AS subnetpools_1_ip_version, subnetpools_1.default_prefixlen AS subnetpools_1_default_prefixlen, subnetpools_1.min_prefixlen AS subnetpools_1_min_prefixlen, subnetpools_1.max_prefixlen AS subnetpools_1_max_prefixlen, subnetpools_1.is_default AS subnetpools_1_is_default, subnetpools_1.default_quota AS subnetpools_1_default_quota, subnetpools_1.hash AS subnetpools_1_hash, subnetpools_1.address_scope_id AS subnetpools_1_address_scope_id, subnetpools_1.standard_attr_id AS subnetpools_1_standard_attr_id, standardattributes_2.id AS standardattributes_2_id, standardattributes_2.resource_type AS standardattributes_2_resource_type, standardattributes_2.description AS standardattributes_2_description, standardattributes_2.revision_number AS standardattributes_2_revision_number, standardattributes_2.created_at AS standardattributes_2_created_at, standardattributes_2.updated_at AS standardattributes_2_updated_at, subnet_dns_publish_fixed_ips_1.subnet_id AS subnet_dns_publish_fixed_ips_1_subnet_id, subnet_dns_publish_fixed_ips_1.dns_publish_fixed_ip AS subnet_dns_publish_fixed_ips_1_dns_publish_fixed_ip \nFROM subnets LEFT OUTER JOIN subnetpools AS subnetpools_1 ON subnets.subnetpool_id = subnetpools_1.id LEFT OUTER JOIN standardattributes AS standardattributes_1 ON standardattributes_1.id = subnetpools_1.standard_attr_id LEFT OUTER JOIN standardattributes AS standardattributes_2 ON standardattributes_2.id = subnets.standard_attr_id LEFT OUTER JOIN subnet_dns_publish_fixed_ips AS subnet_dns_publish_fixed_ips_1 ON subnets.id = subnet_dns_publish_fixed_ips_1.subnet_id]\n(Background on this error at: http://sqlalche.me/e/f405)\n'].
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent Traceback (most recent call last):
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent File "/usr/lib/python3/dist-packages/neutron/agent/dhcp/agent.py", line 266, in sync_state
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent enable_dhcp_filter=False)
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent File "/usr/lib/python3/dist-packages/neutron/agent/dhcp/agent.py", line 826, in get_active_networks_info
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent host=self.host, **kwargs)
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent File "/usr/lib/python3/dist-packages/neutron_lib/rpc.py", line 157, in call
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent return self._original_context.call(ctxt, method, **kwargs)
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent File "/usr/lib/python3/dist-packages/oslo_messaging/rpc/client.py", line 181, in call
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent transport_options=self.transport_options)
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent File "/usr/lib/python3/dist-packages/oslo_messaging/transport.py", line 129, in _send
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent transport_options=transport_options)
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent File "/usr/lib/python3/dist-packages/oslo_messaging/_drivers/amqpdriver.py", line 682, in send
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent transport_options=transport_options)
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent File "/usr/lib/python3/dist-packages/oslo_messaging/_drivers/amqpdriver.py", line 672, in _send
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent raise result
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent oslo_messaging.rpc.client.RemoteError: Remote error: ProgrammingError (pymysql.err.ProgrammingError) (1146, "Table '**neutron.subnet_dns_publish_fixed_ips**' doesn't exist")
/var/log/neutron/neutron-dhcp-agent.log:2022-06-06 12:41:30.169 5355 ERROR neutron.agent.dhcp.agent [SQL: SELECT subnets.project_id AS subnets_project_id, subnets.id AS subnets_id, subnets.in_use AS subnets_in_use, subnets.name AS subnets_name, subnets.network_id AS subnets_network_id, subnets.segment_id AS subnets_segment_id, subnets.subnetpool_id AS subnets_subnetpool_id, subnets.ip_version AS subnets_ip_version, subnets.cidr AS subnets_cidr, subnets.gateway_ip AS subnets_gateway_ip, subnets.enable_dhcp AS subnets_enable_dhcp, subnets.ipv6_ra_mode AS subnets_ipv6_ra_mode, subnets.ipv6_address_mode AS subnets_ipv6_address_mode, subnets.standard_attr_id AS subnets_standard_attr_id, subnetpools_1.shared AS subnetpools_1_shared, standardattributes_1.id AS standardattributes_1_id, standardattributes_1.resource_type AS standardattributes_1_resource_type, standardattributes_1.description AS standardattributes_1_description, standardattributes_1.revision_number AS standardattributes_1_revision_number, standardattributes_1.created_at AS standardattributes_1_cre^C
root#controller:/etc/neutron#
Please help me advise this case. Thanks.
I've found issue. It belonged to MariaDB 10.1 which had a bug. So the problems was resolved after upgrading to 10.6 as below guide.
https://computingforgeeks.com/install-mariadb-on-ubuntu-and-centos/
Note: maybe you need to delete Neutron DB then sync up again.
Related
AIRFLOW - "Oops Something bad has happened"
Everything was working just fine with my airflow fresh install, until I got this "Oops something bad has happened" message again. Had it previously when editing the connections. Traceback (most recent call last): File "/home/mica/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/home/mica/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/mica/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/mica/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise raise value File "/home/mica/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/home/mica/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/mica/.local/lib/python3.8/site-packages/airflow/www/auth.py", line 51, in decorated return func(*args, **kwargs) File "/home/mica/.local/lib/python3.8/site-packages/airflow/www/views.py", line 718, in index paging=wwwutils.generate_pages( File "/home/mica/.local/lib/python3.8/site-packages/airflow/www/utils.py", line 107, in generate_pages first_node = Markup( File "/home/mica/.local/lib/python3.8/site-packages/jinja2/utils.py", line 838, in __new__ warnings.warn( File "/usr/lib/python3.8/warnings.py", line 109, in _showwarnmsg sw(msg.message, msg.category, msg.filename, msg.lineno, File "/home/mica/.local/lib/python3.8/site-packages/airflow/settings.py", line 117, in custom_show_warning write_console.print(msg, soft_wrap=True) File "/home/mica/.local/lib/python3.8/site-packages/rich/console.py", line 1642, in print self._buffer.extend(new_segments) File "/home/mica/.local/lib/python3.8/site-packages/rich/console.py", line 842, in __exit__ self._exit_buffer() File "/home/mica/.local/lib/python3.8/site-packages/rich/console.py", line 800, in _exit_buffer self._check_buffer() File "/home/mica/.local/lib/python3.8/site-packages/rich/console.py", line 1934, in _check_buffer self.file.write(text) OSError: [Errno 5] Input/output error
The problem happened when I was launching airflow from the home. If you navigate to where the application is and then start the webserver, it worked for me.
Airflow Web UI LDAP authentication throws AttributeError: 'NoneType' object has no attribute 'username
I have configured LDAP authentication for airflow, managed in OpenShift. If I access the web UI, without clearing cache, after a redeployment, it throws the following error in web server. It works after the browser cache is cleared. Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 134, in handle self.handle_request(listener, req, client, addr) File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 175, in handle_request respiter = self.wsgi(environ, resp.start_response) File "/usr/local/lib/python3.7/site-packages/werkzeug/middleware/dispatcher.py", line 66, in __call__ return app(environ, start_response) File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2464, in __call__ return self.wsgi_app(environ, start_response) File "/usr/local/lib/python3.7/site-packages/werkzeug/middleware/proxy_fix.py", line 232, in __call__ return self.app(environ, start_response) File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2450, in wsgi_app response = self.handle_exception(e) File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1879, in handle_exception server_error = handler(server_error) File "/usr/local/lib/python3.7/site-packages/airflow/www/views.py", line 776, in show_traceback fallback=True) else 'Error! Please contact server admin'), 500 File "/usr/local/lib/python3.7/site-packages/flask/templating.py", line 136, in render_template ctx.app.update_template_context(context) File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 838, in update_template_context context.update(func()) File "/usr/local/lib/python3.7/site-packages/flask_login/utils.py", line 368, in _user_context_processor return dict(current_user=_get_user()) File "/usr/local/lib/python3.7/site-packages/flask_login/utils.py", line 335, in _get_user current_app.login_manager._load_user() File "/usr/local/lib/python3.7/site-packages/flask_login/login_manager.py", line 359, in _load_user return self.reload_user() File "/usr/local/lib/python3.7/site-packages/flask_login/login_manager.py", line 321, in reload_user user = self.user_callback(user_id) File "/usr/local/lib/python3.7/site-packages/airflow/utils/db.py", line 74, in wrapper return func(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/airflow/contrib/auth/backends/ldap_auth.py", line 280, in load_user return LdapUser(user) File "<string>", line 4, in __init__ File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/state.py", line 433, in _initialize_instance manager.dispatch.init_failure(self, args, kwargs) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 69, in __exit__ exc_value, with_traceback=exc_tb, File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 182, in raise_ raise exception File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/state.py", line 430, in _initialize_instance return manager.original_init(*mixed[1:], **kwargs) File "/usr/local/lib/python3.7/site-packages/airflow/contrib/auth/backends/ldap_auth.py", line 184, in __init__ user.username AttributeError: 'NoneType' object has no attribute 'username Am I missing out anything in airflow.cfg?
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7545): Max retries exceeded with url: /
I created a blockchain app using Ethereum, I downloaded a virtual box. I activated the smart contract on the virtual box and connected it to the Python file on the original device. When the application is executed I get this error: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 144, in _new_conn (self.host, self.port), self.timeout, **extra_kw) File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 83, in create_connection raise err File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen chunked=chunked) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 357, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/lib/python3.6/http/client.py", line 1281, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/lib/python3.6/http/client.py", line 1327, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/lib/python3.6/http/client.py", line 1276, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib/python3.6/http/client.py", line 1042, in _send_output self.send(msg) File "/usr/lib/python3.6/http/client.py", line 980, in send self.connect() File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 169, in connect conn = self._new_conn() File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 153, in _new_conn self, "Failed to establish a new connection: %s" % e) urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fccac7ca5f8>: Failed to establish a new connection: [Errno 111] Connection refused During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/requests/adapters.py", line 440, in send timeout=timeout File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 639, in urlopen _stacktrace=sys.exc_info()[2]) File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=7545): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fccac7ca5f8>: Failed to establish a new connection: [Errno 111] Connection refused',)) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "final.py", line 18, in <module> web3.eth.defaultAccount = web3.eth.accounts[0] File "/usr/local/lib/python3.6/dist-packages/web3/eth.py", line 182, in accounts return self.get_accounts() File "/usr/local/lib/python3.6/dist-packages/web3/module.py", line 44, in caller result = w3.manager.request_blocking(method_str, params, error_formatters) File "/usr/local/lib/python3.6/dist-packages/web3/manager.py", line 154, in request_blocking response = self._make_request(method, params) File "/usr/local/lib/python3.6/dist-packages/web3/manager.py", line 133, in _make_request return request_func(method, params) File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__ File "/usr/local/lib/python3.6/dist-packages/web3/middleware/formatting.py", line 76, in apply_formatters response = make_request(method, params) File "/usr/local/lib/python3.6/dist-packages/web3/middleware/gas_price_strategy.py", line 34, in middleware return make_request(method, params) File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__ File "/usr/local/lib/python3.6/dist-packages/web3/middleware/formatting.py", line 76, in apply_formatters response = make_request(method, params) File "/usr/local/lib/python3.6/dist-packages/web3/middleware/attrdict.py", line 33, in middleware response = make_request(method, params) File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__ File "/usr/local/lib/python3.6/dist-packages/web3/middleware/formatting.py", line 76, in apply_formatters response = make_request(method, params) File "/usr/local/lib/python3.6/dist-packages/web3/middleware/normalize_errors.py", line 25, in middleware result = make_request(method, params) File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__ File "/usr/local/lib/python3.6/dist-packages/web3/middleware/formatting.py", line 76, in apply_formatters response = make_request(method, params) File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__ File "/usr/local/lib/python3.6/dist-packages/web3/middleware/formatting.py", line 76, in apply_formatters response = make_request(method, params) File "/usr/local/lib/python3.6/dist-packages/web3/middleware/exception_retry_request.py", line 105, in middleware return make_request(method, params) File "/usr/local/lib/python3.6/dist-packages/web3/providers/rpc.py", line 95, in make_request **self.get_request_kwargs() File "/usr/local/lib/python3.6/dist-packages/web3/_utils/request.py", line 39, in make_post_request response = session.post(endpoint_uri, data=data, *args, **kwargs) # type: ignore File "/usr/lib/python3/dist-packages/requests/sessions.py", line 567, in post return self.request('POST', url, data=data, json=json, **kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 520, in request resp = self.send(prep, **send_kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 630, in send r = adapter.send(request, **kwargs) File "/usr/lib/python3/dist-packages/requests/adapters.py", line 508, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7545): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fccac7ca5f8>: Failed to establish a new connection: [Errno 111] Connection refused',)) How do I link the smart contract on a computer with the web3.py file on the virtual box??? To do some tests on the Ethereum network
from tensorflow.lite.python.interpreter import Interpreter prevents telepot
Good morning, i am using tensorflow lite and i also wanted to use telepot. I also installed the Coral USB accelerator, but I don't think it depends on him, also because it is independent of whether or not to add --edgetpu to the end of the program start command. It works only if the transfer of messages or images I place it before this instruction: from tensorflow.lite.python.interpreter import Interpreter it's how telepot is incompatible with tflite. Obviously everything works without the telepot instruction What can I do? I'm using a raspberry pi 4 with s.o. Debian burst, Python 3.7 and Opencv 4.1 This is the error that gives me: Traceback (most recent call last): File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 485, in wrap_socket cnx.do_handshake() File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1915, in do_handshake self._raise_ssl_error(self._ssl, result) File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1647, in _raise_ssl_error _raise_current_error() File "/usr/lib/python3/dist-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue raise exception_type(errors) OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')] During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen chunked=chunked, File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 376, in _make_request self._validate_conn(conn) File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn conn.connect() File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/urllib3/connection.py", line 394, in connect ssl_context=context, File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/urllib3/util/ssl_.py", line 370, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 491, in wrap_socket raise ssl.SSLError("bad handshake: %r" % e) ssl.SSLError: ("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])",) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "TFLite_detection_webcam_Prova1.py", line 137, in <module> spedisci() File "TFLite_detection_webcam_Prova1.py", line 33, in spedisci bot.sendPhoto(256868258, foto) File "/usr/local/lib/python3.7/dist-packages/telepot/__init__.py", line 539, in sendPhoto return self._api_request_with_file('sendPhoto', _rectify(p), 'photo', photo) File "/usr/local/lib/python3.7/dist-packages/telepot/__init__.py", line 499, in _api_request_with_file return self._api_request(method, _rectify(params), files, **kwargs) File "/usr/local/lib/python3.7/dist-packages/telepot/__init__.py", line 491, in _api_request return api.request((self._token, method, params, files), **kwargs) File "/usr/local/lib/python3.7/dist-packages/telepot/api.py", line 154, in request r = fn(*args, **kwargs) # `fn` must be thread-safe File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/urllib3/request.py", line 171, in request_encode_body return self.urlopen(method, url, **extra_kw) File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/urllib3/poolmanager.py", line 330, in urlopen response = conn.urlopen(method, u.request_uri, **kw) File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 760, in urlopen **response_kw File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 760, in urlopen **response_kw File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 760, in urlopen **response_kw File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool (host='api.telegram.org', port=443): Max retries exceeded with url: /bot926377239:AAEl0gqMWzG0dMidkGNqcGr2wkeTLbgZn3g/sendPhoto (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))
Flask/uWSGI/MariaDB running under Supervisor stops working almost daily
I'm running a Flask app via uWSGI which is managed by Supervisor (and the webserver is using Nginx). The whole setup seems to work perfectly, however, I notice that every day or two, my flask app starts throwing 500 errors (which means there is a Sqlalchemy db.commit() error) and I can't recover until I go in and reload uwsgi, after which, everything works perfectly again. To reload, I typically kill the uwsgi processes, and supervisor brings them back in and it's fine. Once I've gotten it to work by just 'touch'ing the wsgi file. Also strangely, whenever I run supervisor with processes=1, it automatically loads TWO uwsgi instances. The first PID is the one logged as being operated by supervisor, and the other doesn't register anywhere. However, regardless of this, killing the 2nd process - it always comes back. Below is my uwsgi startup command run by supervisor [program:{{ app_name }}] command=/usr/local/bin/uwsgi --socket=/tmp/{{ app_name }}.sock --logto={{ log_dir }}/application.log --home={{ site_dir }}/env --pythonpath={{ site_dir }} --virtualenv={{ env_path }} --wsgi-file={{ webapps_dir }}/manage.py --callable={{ wsgi_callable }} --max-requests=1000 --master --processes=1 --uid={{ deployment_user }} --gid=www-data --chmod-socket=664 --chown-socket={{ deployment_user }}:www-data directory={{ webapps_dir }} autostart=true autorestart=true EDIT: Here is the error that's spit out from the server. 2015-03-19 15:03:38,389 ERROR: Exception on /api/v1/account/login [POST] [in /var/www/website.com/env/local/lib/python2.7/site-packages/flask/app.py:1423] Traceback (most recent call last): File "/var/www/website.com/env/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/var/www/website.com/env/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/var/www/website.com/env/local/lib/python2.7/site-packages/flask_cors.py", line 272, in wrapped_function return cors_after_request(app.make_response(f(*args, **kwargs))) File "/var/www/website.com/env/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/var/www/website.com/env/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/var/www/website.com/env/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/var/www/website.com/env/local/lib/python2.7/site-packages/flask_classy.py", line 200, in proxy response = view(**request.view_args) File "./webportal/account/api.py", line 34, in login_user user = auth.authenticate(username=email, password=password) File "/var/www/website.com/server/webportal/auth.py", line 23, in authenticate user = User.query.filter_by(email=username).first() File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2367, in first ret = list(self[0:1]) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2228, in __getitem__ return list(res) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2438, in __iter__ return self._execute_and_instances(context) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2453, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 729, in execute return meth(self, multiparams, params) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 322, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 826, in _execute_clauseelement compiled_sql, distilled_params File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 958, in _execute_context context) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1159, in _handle_dbapi_exception exc_info File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause reraise(type(exception), exception, tb=exc_tb) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 951, in _execute_context context) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 436, in do_execute cursor.execute(statement, parameters) File "/var/www/website.com/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute self.errorhandler(self, exc, value) File "/var/www/website.com/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue OperationalError: (OperationalError) (2006, 'MySQL server has gone away') 'SELECT `Users`.id AS `Users_id`, `Users`.email AS `Users_email`, `Users`.password AS `Users_password`, `Users`.`emailConfirmed` AS `Users_emailConfirmed`, `Users`.`createdAtUtc` AS `Users_createdAtUtc`, `Users`.`updatedAtUtc` AS `Users_updatedAtUtc`, `Users`.`roleId` AS `Users_roleId` \nFROM `Users` \nWHERE `Users`.email = %s \n LIMIT %s' ('user#website.demo', 1) 2015-03-19 15:06:22,089 ERROR: Exception on /api/v1/account/login [POST] [in /var/www/website.com/env/local/lib/python2.7/site-packages/flask/app.py:1423] Traceback (most recent call last): File "/var/www/website.com/env/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/var/www/website.com/env/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/var/www/website.com/env/local/lib/python2.7/site-packages/flask_cors.py", line 272, in wrapped_function return cors_after_request(app.make_response(f(*args, **kwargs))) File "/var/www/website.com/env/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/var/www/website.com/env/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/var/www/website.com/env/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/var/www/website.com/env/local/lib/python2.7/site-packages/flask_classy.py", line 200, in proxy response = view(**request.view_args) File "./webportal/account/api.py", line 34, in login_user user = auth.authenticate(username=email, password=password) File "/var/www/website.com/server/webportal/auth.py", line 23, in authenticate user = User.query.filter_by(email=username).first() File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2367, in first ret = list(self[0:1]) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2228, in __getitem__ return list(res) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2438, in __iter__ return self._execute_and_instances(context) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2453, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 729, in execute return meth(self, multiparams, params) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 322, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 826, in _execute_clauseelement compiled_sql, distilled_params File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 893, in _execute_context None, None) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1159, in _handle_dbapi_exception exc_info File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause reraise(type(exception), exception, tb=exc_tb) File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 887, in _execute_context conn = self._revalidate_connection() File "/var/www/website.com/env/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 242, 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) u'SELECT `Users`.id AS `Users_id`, `Users`.email AS `Users_email`, `Users`.password AS `Users_password`, `Users`.`emailConfirmed` AS `Users_emailConfirmed`, `Users`.`createdAtUtc` AS `Users_createdAtUtc`, `Users`.`updatedAtUtc` AS `Users_updatedAtUtc`, `Users`.`roleId` AS `Users_roleId` \nFROM `Users` \nWHERE `Users`.email = %s \n LIMIT %s' [immutabledict({})] According to https://dev.mysql.com/doc/refman/5.0/en/gone-away.html, MySQL closes the connection after 8 hours... Once that happens, the app gets in a bit of a state.