-
Notifications
You must be signed in to change notification settings - Fork 394
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
shutdown hooks stuck waiting for dispose call #1487
Comments
After some further investigation, I was able to reproduce this with a barebones express app instantiated in a similar way to how Nest is doing it. I had to add a call to
in the There is still something funny happening as the next execution cycle after the |
looks like this only happens if we use a.mp4With b.mp4 |
Would you like to create a PR for this issue @micalevisk? |
I didn't investigate it enough :/ I would start by looking at https://github.com/nestjs/nest-cli/blob/master/actions/start.action.ts but I don't have time to tackle this soon. |
@micalevisk I don't use |
@ssilve1989 so, to run the project, you're using |
that's right
i'll try to find some time to try it that way as well with the reproduction repo I provided |
FYI, this should've been fixed with the introduction of the If you create your app using const app = NestFactory.create({ forceCloseConnections: true });
app.enableShutdownHooks(); Nest will keep track of |
Bug Report
When the process receives a SIGINT, the application gets stuck waiting for the
httpAdapter.close()
in thedispose()
call in the shutdown lifecycles. It never reaches the shutdown hooks.Current behavior
When enabling shutdown hooks and having an http server receiving requests from a polling source, like Prometheus, this behavior can be seen when sending a SIGINT into the process. The terminal prompt may be returned, but the process is still alive and providing output to the current terminal context.
Input Code
https://github.com/ssilve1989/nest-sigint-no-exit
Expected behavior
The http server should exit properly. I am not sure if this is a bug in Nest or Express, but it only seems to happen when the process is in the midst of receiving requests.
Possible Solution
Environment
The text was updated successfully, but these errors were encountered: