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

Clear tasks on disabled workers #2208

Merged
merged 1 commit into from
Aug 13, 2017

Conversation

daveFNbuck
Copy link
Contributor

Description

Clear worker task lists on disable to ensure a consistent internal state.

Motivation and Context

One of the uncaught exceptions I was seeing in my scheduler recently was caused by an exception trying to peek at the worker list of a task with empty worker list during count_pending. I solved this in my fork by ignoring the exception, but I think I've now found the real cause.

After a worker is marked disabled, it will call get_work or count_pending one last time before stopping. This call can fail on count_pending when it has a unique task, as that task will now have no
workers but we try to look up the workers from each task.

Have you tested this? If so, how?

Included unit tests, but I haven't tested this particular fix in production. Should we catch the exception too to be safe?

After a worker is marked disabled, it will call get_work or
count_pending one last time before stopping. This call can fail on
count_pending when it has a unique task, as that task will now have no
workers but we try to look up the workers from each task.

To guarantee a more consistent state, we now clear the task list from
each worker on disable.
@daveFNbuck
Copy link
Contributor Author

Looks like one of the e-mail tests might be flaky :(

Copy link
Contributor

@Tarrasch Tarrasch left a comment

Choose a reason for hiding this comment

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

Looks good. I'm ready to merge whenever you feel comfortable. If you don't think it's necessary to test in production I can merge now.

@daveFNbuck
Copy link
Contributor Author

I think this is ok to merge now. I did add it to production with some extra logging to help figure out if there are other causes for this and one other bug I still don't know any cause for. Hopefully I'll have at least one more fix on Monday.

@Tarrasch Tarrasch merged commit 876fe69 into spotify:master Aug 13, 2017
@Tarrasch
Copy link
Contributor

Thanks @daveFNbuck ! :)

This was referenced Jun 29, 2022
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.

2 participants