Delaying unlink or write on a model whose method was replaced raises AttributeError at enqueue time
Maintainer thường phản hồi trong vòng 1 ngày
Một pull request liên quan đã được merge.
- #998 của @akarazhev — đã merge
Đá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
- 35/100
Hướng nghiên cứu
Start by tracing the delayed-call method lookup and job serialization path described in the report, especially queue_job/job.py methods func, description, and _store_values. Reproduce the issue with the provided res.partner.unlink replacement and verify the behavior for both delayable() and with_delay(). Done means the job records and resolves the originally requested method name; an open linked pull request already addresses this issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Module
queue_job (18.0.1.3.0).
Describe the bug
A delayed call (delayable() and with_delay()) is recorded by the __name__ of the function that the
attribute lookup happened to return, not by the name that was looked up
recordset_method = getattr(self.recordset, name)
self._job_method = recordset_method
This leads to:
File "queue_job/job.py", in _store_values
"name": self.description,
File "queue_job/job.py", in description
elif self.func.__doc__:
File "queue_job/job.py", in func
return getattr(recordset, self.method_name)
AttributeError: 'res.partner' object has no attribute 'unlink_renamed'
To Reproduce
Affected Versions:
Occured on 18.0 but code is unchanged on newer versions.
cls = type(env["res.partner"])
original = cls.unlink
def unlink_renamed(self):
return unlink_renamed.origin(self)
unlink_renamed.origin = original
cls.unlink = unlink_renamed
partner = env["res.partner"].create({"name": "test"})
partner.delayable().unlink().delay()
Expected behavior
The job records the method under the name it was requested with, and resolves
that name again, independent of what the attribute currently points at.
Additional context
Where this shows up in practice
auditlog (https://github.com/OCA/server-tools) installs its replacements as write_full and unlink_full into
the write and unlink slots, so any delayed write or unlink on an
audited model fails this way.
- Ngôn ngữ chính
- Python
- Star
- 271
- Fork
- 602
- Merge trung bình
- 5 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của OCA/queue
-
enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Migration to version 20.0Đang mởhelp wanted no stale work in progress
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
OCA/queue#1002 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[19.0] queue_job: Jobs stay pending after the jobrunner's database connection is silently droppedCó thể đã có người làm @HoloborodkoBohdan đã nhận 31 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
OCA/queue#984 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[RFC] relative channel capacityĐang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
OCA/queue#964 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
infrastructure
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
NatLabRockies/H2Integrate#977 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
topoteretes/cognee#6470 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
area:docs priority:p2 type:docs wave:9
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
jejjohnson/radtrax#293 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug core plugins
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
bunkerity/bunkerweb#4121 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày