Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] queue_job: detect jobs runned by workers that have been killed #713

Closed
wants to merge 1 commit into from

Conversation

AnizR
Copy link

@AnizR AnizR commented Dec 3, 2024

Goal

Do not keep jobs in 'started' status if their associated worker have been killed by a timeout and directly set it as 'failed'

@OCA-git-bot
Copy link
Contributor

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

Copy link
Contributor

@amh-mw amh-mw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a recurring problem for me, so I will backport to 15.0 shortly after merge.


for job in jobs:
if not psutil.pid_exists(job.worker_pid):
_logger.info("a process with pid %d does not exist" % job.worker_pid)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I saw this in the logs, I don't think I'd know what to look for. Maybe say "a queue_job process" instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, i forgot to remove it, it to ensure that it was working during my tests 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think there is value in logging unexpected queue_job workers deaths with greater specificity than the generic werkzeug worker timeout message.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I updated the message to give the worker pid and the job uuid.

queue_job/models/queue_job.py Outdated Show resolved Hide resolved
Copy link
Member

@guewen guewen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, sadly the pid may be on another host and still executing

@AnizR
Copy link
Author

AnizR commented Dec 3, 2024

Hi, sadly the pid may be on another host and still executing

What would you advise ?
Making the server update the job before killing the worker? (extending the function process_timeout ? I have no idea if it is possible )

@amh-mw
Copy link
Contributor

amh-mw commented Dec 3, 2024

Hi, sadly the pid may be on another host and still executing

Record the hostname / other signature of the host and filter accordingly? Config parameter gate this feature?

@sbidoul
Copy link
Member

sbidoul commented Dec 4, 2024

@AnizR I think #423 was promising and is still the best approach I can think of.

@AnizR
Copy link
Author

AnizR commented Dec 6, 2024

This wasn't a good approach.
I have created another PR #716 that seems more promising.

@AnizR AnizR closed this Dec 6, 2024
@AnizR AnizR deleted the zra-imp-timeout branch December 6, 2024 10:56
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.

5 participants