-
Notifications
You must be signed in to change notification settings - Fork 434
Open
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
Running nest start and then terminating the application using CTRL+C doesn't await asynchronous shutdown hooks (onModuleDestroy, beforeApplicationShutdown, onApplicationShutdown). Instead, the process exits before they are completed, but the application still completes gracefully.
Things I've tried:
app.enableShutdownHooks();is enabled- I've found a similar issue getting
EADDRINUSEerror when using start with watch mode with an asyncbeforeApplicationShutdown#1614 that was fixed by--no-shell; however, it doesn't resolve the problem here.
Minimum reproduction code
https://github.com/MrBartusek/shutdown-bug
Steps to reproduce
- Clone and setup my repo https://github.com/MrBartusek/shutdown-bug. Only changes are in
app.module.tshttps://github.com/MrBartusek/shutdown-bug/blob/master/src/app.module.ts - Run
nest start - Terminate using
CTRL+C - See error
Expected behavior
Running node dist/main waits for shutdown correctly, I would expect it would work the same here
Package version
11.0.10
NestJS version
11.1.6
Node.js version
20.19.2
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
I'am using WSL with Ubuntu 22.04.3
Reactions are currently unavailable