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

Fix race condition on worker failure #107

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MetalBlueberry
Copy link
Contributor

If a worker fails, the context is cancelled, this leads to all workers+the scanner stopping immediately.

The race conditions happens because if all the workers close before the scanner, the code will proceed and close the error channel. Then the scanner fails when attempting to publish to the error channel.

This is solved by adding the scanner to the worker group. this will make sure we always wait for all goroutines that publish to errCh to stop

If a worker fails, the context is cancelled, this leads to all workers+the scanner stopping immediately.

The race conditions happens because if all the workers close before the scanner, the code will proceed and close the error channel. Then the scanner fails when attempting to publish to the error channel.

This is solved by adding the scanner to the worker group. this will make sure we always wait for all goroutines that publish to errCh to stop
@MetalBlueberry MetalBlueberry marked this pull request as ready for review December 19, 2024 16:25
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.

1 participant