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

Đang mở
#1,026 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
22/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
postgresql, python
Lĩnh vực
backend, performance

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
Python
Star
271
Fork
602
Merge trung bình
4 ngày 4 giờ
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của OCA/queue

Tất cả issue của OCA/queue

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.