OCA / queue

Asynchronous Job Queue
GNU Affero General Public License v3.0
181 stars 459 forks source link

[16.0][FIX] queue_job: fix deadlock #672

Open BT-sschmid opened 3 months ago

BT-sschmid commented 3 months ago

Fix a deadlock condition when there are dependent stored fields on queue.job:state.

Example:

This commit adds a rollback in case of error during job execution, so that any locks are released.

OCA-git-bot commented 3 months ago

Hi @guewen, some modules you are maintaining are being modified, check this out!

BT-sschmid commented 2 months ago

Though I generally agree with the intent of this change, there is already some rollback code in the enclosing runjob call, specifically a rollback in the event of a RetryableJobError. It makes me question why the except (FailedJobError, Exception) stanza doesn't rollback as well, choosing instead to grab a different cursor to commit the job state.

now I got your comment ^^ Indeed I also don't see the need to use a new cursor if the tx is rolled back. If you agree I change it to just rollback.