Skip to content

getting EADDRINUSE error when using start with watch mode with an async beforeApplicationShutdown #1614

@micalevisk

Description

@micalevisk

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

when we have an async beforeApplicationShutdown that takes too long to resolve, nest start --watch doesn't kill all the processes properly after file changes, which leads to an EADDRINUSE: address already in use error

issue_demo.mp4

Minimum reproduction code

https://gitlab.com/micalevisk/nestjs-cli-issue-1614

Steps to reproduce

git clone https://gitlab.com/micalevisk/nestjs-cli-issue-1614 
cd nestjs-cli-issue-1614 
  1. npm ci
  2. npm run start:dev
  3. change any source file
  4. see the error

Expected behavior

nestjs CLI should kill all processes before restarting the app

Package version

8.2.x
9.2.x - using forceCloseConnections: true doesn't fixes this
10.0.3

NestJS version

8.4.x
9.3.x
10.0.3

Node.js version

16.14.2

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions