[18.0] queue_job: job failed to be requeued or cancelled if function is removed while job not yet done
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 38/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Lingua principale
- Python
- Stelle
- 271
- Fork
- 602
- Merge medio
- 5g 1h
- PR unite (30g)
- 7
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OCA/queue
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
I maintainer di solito rispondono entro 1 giorno
-
Migration to version 20.0Apertahelp wanted no stale work in progress
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Delaying unlink or write on a model whose method was replaced raises AttributeError at enqueue timeForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
[19.0] queue_job: Jobs stay pending after the jobrunner's database connection is silently droppedForse già presa @HoloborodkoBohdan l’ha presa 31 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
OCA/queue#984 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
aws-samples/sample-per-model-bedrock#639 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
awslabs/visual-asset-management-system#937 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
project-codeflare/codeflare-sdk#1195 ·
I maintainer di solito rispondono entro 1 giorno
-
Bump numpy dependencyAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
pandas-dev/pandas-stubs#2051 ·
I maintainer di solito rispondono entro 1 giorno