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 racy requester shutdown logic #286

Merged
merged 1 commit into from
Jun 27, 2021
Merged

Conversation

ZymoticB
Copy link
Contributor

This change resolves the panic in #268. The requester shutdown logic was not
correctly waiting for the worker ticker to shutdown which could cause
the shutdown logic to run concurrently with new workers being created.
This doesn't fail race tests because the workers array is protected by
a mutex, but the length of b.workers used for b.workers[i].Stop()
is not guaranteed to be the same as the length used to collect errors
from errC.

This is possible for example with the default concurrency schedule, and
a service that completes -c requests faster than it takes to create
-c workers. This means that the load test finishes before the first
worker TickValue has been processed. The workers that are created
after the b.workers[i].Stop() loop run forever and the process doesn't
respond to SIGINT, it has to be SIGKILLed.

This change resolves the panic in bojand#268. The requester shutdown logic was not
correctly waiting for the worker ticker to shutdown which could cause
the shutdown logic to run concurrently with new workers being created.
This doesn't fail race tests because the workers array is protected by
a mutex, but the length of `b.workers` used for `b.workers[i].Stop()`
is not guaranteed to be the same as the length used to collect errors
from errC.

This is possible for example with the default concurrency schedule, and
a service that completes `-c` requests faster than it takes to create
`-c` workers. This means that the load test finishes before the first
worker `TickValue` has been processed. The workers that are created
after the `b.workers[i].Stop()` loop run forever and the process doesn't
respond to SIGINT, it has to be SIGKILLed.
@bojand bojand merged commit bb76581 into bojand:master Jun 27, 2021
@bojand
Copy link
Owner

bojand commented Jun 27, 2021

Thanks for the PR! Should be in 0.96.0.

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