jubastik / homework-hub Goto Github PK
View Code? Open in Web Editor NEWБот для сохранения и обмена домашним заданием
Бот для сохранения и обмена домашним заданием
postgresql не отвечает
Надо глянуть что там на серваке, не перегружен ли он.
Вообще бот медленно отвечает, как полностью серверный, так и локальный в связке BOT(local)-API(local)-postgresql(SERVER)
Связка BOT(local)-API(local)-sqlite(local) работает быстро
Запросы на которых падал с этой ошибкой. (подозреваю что не важно, какой запрос, просто сервер дохнет, тем более я не очень много тестил)
127.0.0.1 - - [12/Jul/2022 21:00:08] "DELETE /api/user/tg/809737708?force=False HTTP/1.1" 500
127.0.0.1 - - [12/Jul/2022 20:53:30] "GET /api/user/tg/809737708 HTTP/1.1" 500
Краткий лог API:
sqlalchemy.exc.TimeoutError: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30.00 (Background on this error at: https://sqlalche.me/e/14/3o7r)
Полный лог API:
127.0.0.1 - - [12/Jul/2022 20:53:30] "GET /api/user/tg/809737708 HTTP/1.1" 500 -
Traceback (most recent call last):
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 2091, in call
return self.wsgi_app(environ, start_response)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "C:\Users\Rulka\Main\programming\projects\HomeBot\API\api_modules\user_api.py", line 28, in get_user
id = user_id_processing(platform, user_id)
File "C:\Users\Rulka\Main\programming\projects\HomeBot\API\api_modules\core.py", line 22, in user_id_processing
id = db_sess.query(Student.id).filter(Student.tg_id == id).first()
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\query.py", line 2810, in first
return self.limit(1)._iter().first()
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\query.py", line 2894, in _iter
result = self.session.execute(
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\session.py", line 1691, in execute
conn = self._connection_for_bind(bind)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\session.py", line 1532, in _connection_for_bind
return self._transaction._connection_for_bind(
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\session.py", line 747, in _connection_for_bind
conn = bind.connect()
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 3204, in connect
return self._connection_cls(self, close_with_result=close_with_result)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 96, in init
else engine.raw_connection()
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 3283, in raw_connection
return self._wrap_pool_connect(self.pool.connect, _connection)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 3250, in _wrap_pool_connect
return fn()
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\pool\base.py", line 310, in connect
return _ConnectionFairy._checkout(self)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\pool\base.py", line 868, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\pool\base.py", line 476, in checkout
rec = pool._do_get()
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\pool\impl.py", line 134, in _do_get
raise exc.TimeoutError(
sqlalchemy.exc.TimeoutError: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30.00 (Background on this error at: https://sqlalche.me/e/14/3o7r)
если в API придёт запрос на день недели воскресенье (POST /api/homework), то сервер упадёт с 500 ошибкой.
Скорее всего причина бага это отсутствие обработки данной ситуации.
при удалении юзера, сервер возвращает 500 код.
Логи СЕРВЕРА:
127.0.0.1 - - [24/Jun/2022 16:27:33] "DELETE /api/user/tg/809737708?force=False HTTP/1.1" 500 -
Traceback (most recent call last):
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 1802, in _execute_context
self.dialect.do_execute(
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\default.py", line 732, in do_execute
cursor.execute(statement, parameters)
psycopg2.errors.ForeignKeyViolation: update or delete on table "students" violates foreign key constraint "homeworks_author_id_fkey" on table "homeworks"
DETAIL: Key (id)=(1) is still referenced from table "homeworks".
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 2091, in call
return self.wsgi_app(environ, start_response)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "C:\Users\Rulka\Main\programming\projects\HomeBot\API\api_modules\user_api.py", line 116, in del_user
db_sess.commit()
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\session.py", line 1431, in commit
self._transaction.commit(_to_root=self.future)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\session.py", line 829, in commit
self._prepare_impl()
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\session.py", line 808, in _prepare_impl
self.session.flush()
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\session.py", line 3363, in flush
self._flush(objects)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\session.py", line 3503, in flush
transaction.rollback(capture_exception=True)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\util\langhelpers.py", line 70, in exit
compat.raise(
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\util\compat.py", line 207, in raise
raise exception
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\session.py", line 3463, in _flush
flush_context.execute()
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\unitofwork.py", line 456, in execute
rec.execute(self)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\unitofwork.py", line 667, in execute
util.preloaded.orm_persistence.delete_obj(
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\persistence.py", line 342, in delete_obj
_emit_delete_statements(
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\persistence.py", line 1442, in _emit_delete_statements
c = connection._execute_20(
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 1614, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\sql\elements.py", line 325, in _execute_on_connection
return connection._execute_clauseelement(
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 1481, in _execute_clauseelement
ret = self._execute_context(
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 1845, in _execute_context
self.handle_dbapi_exception(
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 2026, in handle_dbapi_exception
util.raise(
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\util\compat.py", line 207, in raise
raise exception
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 1802, in _execute_context
self.dialect.do_execute(
File "C:\Users\Rulka\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\default.py", line 732, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (psycopg2.errors.ForeignKeyViolation) update or delete on table "students" violates foreign key constraint "homeworks_author_id_fkey" on table "homeworks"
DETAIL: Key (id)=(1) is still referenced from table "homeworks".
[SQL: DELETE FROM students WHERE students.id = %(id)s]
[parameters: {'id': 1}]
(Background on this error at: https://sqlalche.me/e/14/gkpj)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.