Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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