-
-
Notifications
You must be signed in to change notification settings - Fork 762
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
[BUG] asynq:servers and asynq:workers not cleaned after shutdown #979
Comments
As I understand the issue lies somewhere in the lock of the server.Shutdown(). In my code I call server.Run() and server.Shutdown(). And server.Run() actually already have signals waiting and Shutdown(). When I remove server.Shutdown() from a client code everything runs smoothly and clean up happens. Ideally need to handle this case properly (lock) or remove shutdown from the public api. |
Server.Run internally registers SIGINT listeners. Could you use Server.Start instead because you are registering your own listeners. Also, could you try with v0.24.1 and see if it is reproducible. |
Tried the same with v0.24.1 and the result is the same. It requires use some delay/sleep to clean up. Anyway, thank you for the response. |
I managed to reproduce it. It is in fact a bug. If the server state is never set with Stop the entire shutdown procedure is skipped. On Unix it is never stopped unless SIGSTP is called. https://github.com/hibiken/asynq/blob/master/signals_unix.go#L25 The 2 second that you add allows the Stop to actually set the correct state which further allows the seconds explicit shutdown to complete before the goroutine can return. I'll push some code that you can try out. |
… for the shutdown procedure to complete successfully * possibly fixes: #979
@Skwol Could you try: go get github.com/hibiken/asynq@71c746d00af93fed64d0daafd8fb5e884f7cc243 |
I updated my code. The cleanup worked fine with this version. Thank you, hope to see it in the new release! |
… for the shutdown procedure to complete successfully (hibiken#982) * fixes: hibiken#979
Describe the bug
redis
asynq:servers
andasynq:workers
sets are note being cleaned up during server shutdown.Environment (please complete the following information):
asynq
package version v0.25.0To Reproduce
Perform same actions but add time.Sleep(2*time.Second) after server.Shutdown() and you can see that closed workers/servers cleaned up.
Dockerfile:
docker-compose.yaml:
main.go:
Expected behavior
redis sets
asynq:servers
andasynq:workers
should not contain old servers/workersAdditional context
In some infrastructure where we might have a lot of workers these sets become huge during active development. Not sure when it will affect performance or cause any troubles.
The text was updated successfully, but these errors were encountered: