[18.0] queue_job: job failed to be requeued or cancelled if function is removed while job not yet done
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 38/100
Rechercherichtung
The failure is in _change_job_state in queue_job/models/queue_job.py, which calls Job.load, and in _load_from_db_record in queue_job/job.py, where getattr(recordset, method_name) raises once the function is removed. Start by reading those two spots and deciding whether state-only actions (requeue, cancel, set done) can skip resolving the method. Done means those actions succeed on a job whose method no longer exists, with a test covering that case. The issue itself leaves the expected behaviour open, so check with maintainers first.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Module
queue_job
Describe the bug
If a job having its function (job.method_name) removed, while being pending/enqueued or failed (maybe, I haven't double checked but I think loading failed jobs during initialization), the job runner will stuck trying to requeue the job as failing to load the job. Trying to cancel to unlink the job from UI will also fail due to the same reason.
To Reproduce
Affected versions: 18.0 but properly other versions too.
Steps to reproduce the behavior: Explained in the description.
Expected behavior
I don't really know whether this is truly a bug, or it's missing a reliable way to prevent this from happening, maybe it's a rule of thumb to not having function removed if it's used in queue job, but since function can be enqueue anywhere using with_delay or delayable(), it's hard to tell which functions are used with queue job. Unless we always define job as job function to allow enqueueing it.
A way to prevent this issue from happening without enforcing how to implement jobs or control the development is to not loading the job if we are just setting the state of it (requeue, cancel or set done).
Additional context
Below is where it fails, since method_name is removed, getattr simply break
File "/opt/odoo/src/queue/queue_job/models/queue_job.py", line 309, in _change_job_state
job_ = Job.load(record.env, record.uuid)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/odoo/src/queue/queue_job/job.py", line 213, in load
return cls._load_from_db_record(stored)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/odoo/src/queue/queue_job/job.py", line 288, in _load_from_db_record
method = getattr(recordset, method_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Vorherrschende Sprache
- Python
- Sterne
- 271
- Forks
- 602
- Ø Merge
- 4 T. 4 Std.
- Gemergte PRs (30 T.)
- 6
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus OCA/queue
-
enhancement
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 30/100
Maintainer antworten meist innerhalb von 1 Tag
-
help wanted no stale work in progress
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
OCA/queue#1002 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Delaying unlink or write on a model whose method was replaced raises AttributeError at enqueue timeEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenbug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
Maintainer antworten meist innerhalb von 1 Tag
-
[19.0] queue_job: Jobs stay pending after the jobrunner's database connection is silently droppedEvtl. vergeben @HoloborodkoBohdan hat das vor 32 Tagen übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 25/100
OCA/queue#984 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
NousResearch/hermes-agent#147104 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[oblt-aw][autodoc] Document new required `shared-org-key` input for `obs-aw-dependency-review`Evtl. vergeben @github-actions hat das heute übernommen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
Maintainer antworten meist innerhalb von 1 Tag
-
bot-triaged module: inductor oncall: pt2 topic: fuzzer triaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
getchaintips leaves out the active tip once a header is staged on it, where Core always lists itOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
btclib-org/btclib-node#2158 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
patrick-hudson/put.gd-desktop#979 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag