furlongm / patchman

Patchman is a Linux Patch Status Monitoring System
http://patchman.openbytes.ie
GNU General Public License v3.0
357 stars 77 forks source link

[ERROR/ForkPoolWorker-1] An error occurred in the current transaction. You can't execute queries until the end of the ' atomic' block #530

Open tabacha opened 10 months ago

tabacha commented 10 months ago

python3-patchman 2.0.14-1 On ubuntu:

Celery gives the follwing stacktrace in Logfile:

Nov 23 06:44:05 patchman celery[15221]: [2023-11-23 07:44:05,355: INFO/MainProcess] Task reports.tasks.process_report[ff34a50c-4fbb-4084-bdd1-3d4eb5f6f337] received
Nov 23 06:44:09 patchman celery[15221]: [2023-11-23 07:44:09,403: INFO/MainProcess] Task reports.tasks.process_report[35bccd8e-2267-4e67-9624-875deaed478a] received
Nov 23 06:44:11 patchman celery[15221]: [2023-11-23 07:44:11,925: INFO/MainProcess] Task reports.tasks.process_report[a6f515fd-907f-4121-b016-9fd6ae127f56] received
Nov 23 06:44:15 patchman celery[15221]: [2023-11-23 07:44:15,843: INFO/MainProcess] Task reports.tasks.process_report[fbb97bbd-8258-4ff9-8f12-da1ac9695d1a] received
Nov 23 06:44:19 patchman celery[15230]: [2023-11-23 07:44:19,375: WARNING/ForkPoolWorker-1] (1213, 'Deadlock found when trying to get lock; try restarting transaction')
Nov 23 06:44:19 patchman celery[15230]: [2023-11-23 07:44:19,377: WARNING/ForkPoolWorker-1] An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block.
Nov 23 06:44:19 patchman celery[15230]: [2023-11-23 07:44:19,380: ERROR/ForkPoolWorker-1] Task reports.tasks.process_report[fbb97bbd-8258-4ff9-8f12-da1ac9695d1a] raised unexpected: TransactionManagementError("An error occurred in the current transaction. You can't execute queries until the end of the '
atomic' block.")
Nov 23 06:44:19 patchman celery[15230]: Traceback (most recent call last):
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/celery/app/trace.py", line 451, in trace_task
Nov 23 06:44:19 patchman celery[15230]:     R = retval = fun(*args, **kwargs)
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/celery/app/trace.py", line 734, in __protected_call__
Nov 23 06:44:19 patchman celery[15230]:     return self.run(*args, **kwargs)
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/reports/tasks.py", line 29, in process_report
Nov 23 06:44:19 patchman celery[15230]:     report.process(verbose=True)
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/reports/models.py", line 157, in process
Nov 23 06:44:19 patchman celery[15230]:     process_packages(report=self, host=host)
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/reports/utils.py", line 79, in process_packages
Nov 23 06:44:19 patchman celery[15230]:     ptext=f'{str(host)[0:25]!s} packages',
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/reports/utils.py", line 312, in process_package
Nov 23 06:44:19 patchman celery[15230]:     else:
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/packages/utils.py", line 258, in get_or_create_package
Nov 23 06:44:19 patchman celery[15230]:     p_arch, c = package_arches.get_or_create(name=arch)
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 581, in get_or_create
Nov 23 06:44:19 patchman celery[15230]:     return self.get(**kwargs), False
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 431, in get
Nov 23 06:44:19 patchman celery[15230]:     num = len(clone)
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 262, in __len__
Nov 23 06:44:19 patchman celery[15230]:     self._fetch_all()
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 1324, in _fetch_all
Nov 23 06:44:19 patchman celery[15230]:     self._result_cache = list(self._iterable_class(self))
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 51, in __iter__
Nov 23 06:44:19 patchman celery[15230]:     results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
Nov 23 06:44:19 patchman celery[15230]:     cursor.execute(sql, params)
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 66, in execute
Nov 23 06:44:19 patchman celery[15230]:     return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
Nov 23 06:44:19 patchman celery[15230]:     return executor(sql, params, many, context)
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 78, in _execute
Nov 23 06:44:19 patchman celery[15230]:     self.db.validate_no_broken_transaction()
Nov 23 06:44:19 patchman celery[15230]:   File "/usr/lib/python3/dist-packages/django/db/backends/base/base.py", line 447, in validate_no_broken_transaction
Nov 23 06:44:19 patchman celery[15230]:     raise TransactionManagementError(
Nov 23 06:44:19 patchman celery[15230]: django.db.transaction.TransactionManagementError: An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block.
Nov 23 06:44:21 patchman celery[15233]: [2023-11-23 07:44:21,721: INFO/ForkPoolWorker-4] Task reports.tasks.process_report[ff34a50c-4fbb-4084-bdd1-3d4eb5f6f337] succeeded in 16.364191931003006s: None
furlongm commented 9 months ago

Can you check if this issue persists with v3?

tabacha commented 8 months ago

Hi, I can see no such error in our logfile since install of v3.