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

Aperta
#1,026 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
22/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
postgresql, python

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
Python
Stelle
271
Fork
602
Merge medio
4g 4h
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OCA/queue

Tutte le issue di OCA/queue

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.