You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting in v15.4.x, running a Nest application using "serve" will not terminate the previous process before starting resulting in Error: listen EADDRINUSE: address already in use error.
Expected Behavior
When "serve" restarts a Nest application it should stop the old process to free the port. This works correctly in v15.3.x.
Node : 16.18.0
OS : darwin x64
pnpm : 7.13.6
nx : 15.4.1
@nrwl/angular : Not Found
@nrwl/cypress : Not Found
@nrwl/detox : Not Found
@nrwl/devkit : 15.4.1
@nrwl/esbuild : Not Found
@nrwl/eslint-plugin-nx : 15.4.1
@nrwl/expo : Not Found
@nrwl/express : Not Found
@nrwl/jest : 15.4.1
@nrwl/js : 15.4.1
@nrwl/linter : 15.4.1
@nrwl/nest : 15.4.1
@nrwl/next : Not Found
@nrwl/node : 15.4.1
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : Not Found
@nrwl/react-native : Not Found
@nrwl/rollup : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : Not Found
@nrwl/web : Not Found
@nrwl/webpack : 15.4.1
@nrwl/workspace : 15.4.1
@nrwl/vite : Not Found
typescript : 4.8.4
---------------------------------------
Local workspace plugins:
---------------------------------------
Community plugins:
Failure Logs
$ pnpm nx run test-app:serve
> nx run test-app:serve
chunk (runtime: main) main.js (main) 2.91 KiB [entry] [rendered]
webpack compiled successfully (de5400e62644fad2)
Debugger listening on ws://localhost:9229/78362889-df62-4997-9b25-e787dd5b6ebb
Debugger listening on ws://localhost:9229/78362889-df62-4997-9b25-e787dd5b6ebb
For help, see: https://nodejs.org/en/docs/inspector
Type-checking in progress...
[Nest] 74415 - 12/26/2022, 1:16:54 PM LOG [NestFactory] Starting Nest application...
[Nest] 74415 - 12/26/2022, 1:16:54 PM LOG [InstanceLoader] AppModule dependencies initialized +59ms
[Nest] 74415 - 12/26/2022, 1:16:54 PM LOG [RoutesResolver] AppController {/api}: +16ms
[Nest] 74415 - 12/26/2022, 1:16:54 PM LOG [RouterExplorer] Mapped {/api, GET} route +3ms
[Nest] 74415 - 12/26/2022, 1:16:54 PM LOG [NestApplication] Nest application successfully started +2ms
[Nest] 74415 - 12/26/2022, 1:16:54 PM LOG 🚀 Application is running on: http://localhost:3333/api
No errors found.
chunk (runtime: main) main.js (main) 2.91 KiB [entry]
webpack compiled successfully (de5400e62644fad2)
No errors found.
Starting inspector on localhost:9229 failed: address already in use
[Nest] 74427 - 12/26/2022, 1:16:59 PM LOG [NestFactory] Starting Nest application...
[Nest] 74427 - 12/26/2022, 1:16:59 PM LOG [InstanceLoader] AppModule dependencies initialized +33ms
[Nest] 74427 - 12/26/2022, 1:16:59 PM LOG [RoutesResolver] AppController {/api}: +6ms
[Nest] 74427 - 12/26/2022, 1:16:59 PM LOG [RouterExplorer] Mapped {/api, GET} route +3ms
[Nest] 74427 - 12/26/2022, 1:16:59 PM LOG [NestApplication] Nest application successfully started +2ms
[Nest] 74427 - 12/26/2022, 1:16:59 PM ERROR [NestApplication] Error: listen EADDRINUSE: address already in use :::3333 +2ms
Error: listen EADDRINUSE: address already in use :::3333
at Server.setupListenHandle [as _listen2] (node:net:1463:16)
at listenInCluster (node:net:1511:12)
at Server.listen (node:net:1599:7)
at ExpressAdapter.listen (/Users/test/test-app/node_modules/.pnpm/@nestjs+platform-express@9.2.1_hjcqpoaebdr7gdo5hgc22hthbe/node_modules/@nestjs/platform-express/adapters/express-adapter.js:78:32)
at /Users/test/test-app/node_modules/.pnpm/@nestjs+core@9.2.1_e6la6qvsclaae2becwjnmfvsuq/node_modules/@nestjs/core/nest-application.js:167:30
at new Promise (<anonymous>)
at NestApplication.listen (/Users/test/test-app/node_modules/.pnpm/@nestjs+core@9.2.1_e6la6qvsclaae2becwjnmfvsuq/node_modules/@nestjs/core/nest-application.js:156:16)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Additional Information
Original process is not terminated (SIGTERM is not called). This is a regression. If you switch to v15.3.3 the same code works correctly. Node inspector also appears to be impacted by this bug.
The text was updated successfully, but these errors were encountered:
Current Behavior
Starting in v15.4.x, running a Nest application using "serve" will not terminate the previous process before starting resulting in
Error: listen EADDRINUSE: address already in use
error.Expected Behavior
When "serve" restarts a Nest application it should stop the old process to free the port. This works correctly in v15.3.x.
Here are the logs using v15.3.3:
Github Repo
No response
Steps to Reproduce
pnpx create-nx-workspace test-app --preset=nest --appName=test-app
apps/test-app/src/main.ts
, add call to app.enableShutdownHooks() and log a message when process terminates:pnpm nx run test-app:serve
Nx Report
Failure Logs
Additional Information
Original process is not terminated (SIGTERM is not called). This is a regression. If you switch to v15.3.3 the same code works correctly. Node inspector also appears to be impacted by this bug.
The text was updated successfully, but these errors were encountered: