⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@sbidoul
Copy link
Member

@sbidoul sbidoul commented Jan 21, 2026

Commiting in a job would release the job lock, causing spurious restarts by the dead jobs requeuer.

Very much draft and untested at this point.

@OCA-git-bot
Copy link
Contributor

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

This would release the job lock, causing spurious restarts by the dead jobs requeuer.
@guewen
Copy link
Member

guewen commented Jan 23, 2026

As I understand, it is very likely to happen when using queue_job_cron, as a lot of cron methods do intermediate commits

@sbidoul
Copy link
Member Author

sbidoul commented Jan 23, 2026

Precisely, yes.

@sbidoul
Copy link
Member Author

sbidoul commented Jan 23, 2026

@guewen an alternative would be to acquire the job lock with a separate cursor, the drawback being doubling the number of postgres connections required for jobs.

I'm not sure how prevalent the problem is, so to understand better I'm inclined to merge this so affected users get a clear error instead of hard to diagnose issues with job running multiple times. And if it appears that commit in jobs is a really really important use case then we can consider alternatives.

@guewen
Copy link
Member

guewen commented Jan 23, 2026

I'm inclined to merge this so affected users get a clear error instead of hard to diagnose issues with job running multiple times.

Yes, even if crons/jobs are supposed to be idempotent, in case they are not, it can be devastating in some cases if they are run several times concurrently. A clear error is indeed much better than unexpected and erratic behavior.

And it is not blocking anybody because if a cron job is flagged as "run as job" and raises "Commit is forbidden in queue jobs" because of a commit, they can still run it as a normal cron. Thinking about it, we may add some details in the error message, ex "Commit is forbidden in queue jobs. If the current job is a cron running as job, it should be run as a normal job"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants