[18.0] queue_job: remove_db -> psycopg2.DatabaseError: out of memory for query result

Offen
#1,026 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
22/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
postgresql, python
Bereich
backend, performance

Rechercherichtung

The traceback points to initialize_databases in queue_job/jobrunner/runner.py (around line 403), which iterates a cursor over every queue_job row, and to remove_db in queue_job/jobrunner/channels.py (around line 1139), which copies _jobs_by_uuid into a list. Read how the job loading query is built and how the channel manager stores jobs. Done means the runner survives a backlog of millions of pending jobs without loading them all into memory, ideally with a test or a reproduction script that shows the memory use.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug

Module

queue_job

Describe the bug

2026-11-01 13:40:47,969 147583 ERROR ? odoo.addons.queue_job.jobrunner.runner: exception: sleeping 5s and retrying
--
Traceback (most recent call last):
File "/usr/local/src/metricwise/oca/queue/queue_job/jobrunner/runner.py", line 502, in run
self.initialize_databases()
File "/usr/local/src/metricwise/oca/queue/queue_job/jobrunner/runner.py", line 403, in initialize_databases
for job_data in cr:
psycopg2.DatabaseError: out of memory for query result
2026-11-01 13:40:47,972 147583 WARNING ? odoo.addons.queue_job.jobrunner.runner: error closing database odoo
Traceback (most recent call last):
File "/usr/local/src/metricwise/oca/queue/queue_job/jobrunner/runner.py", line 390, in close_databases
self.channel_manager.remove_db(db_name)
File "/usr/local/src/metricwise/oca/queue/queue_job/jobrunner/channels.py", line 1139, in remove_db
for job in list(self._jobs_by_uuid.values()):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
MemoryError
>>> env.cr.execute('SELECT state, count(*) FROM queue_job GROUP BY state')
>>> env.cr.fetchall()
[('done', 81056), ('enqueued', 1), ('failed', 150), ('pending', 4009271), ('wait_dependencies', 3)]

To Reproduce

Affected versions: 18.0.3.1.3

Steps to reproduce the behavior:

  1. Queue up several million jobs.
  2. Attempt to run them.
Vorherrschende Sprache
Python
Sterne
271
Forks
602
Ø Merge
4 T. 4 Std.
Gemergte PRs (30 T.)
6

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus OCA/queue

Alle Issues in OCA/queue

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.