Skip to content
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

@nrwl/node:execute does not wait for app to stop #1728

Closed
pburgmer opened this issue Aug 15, 2019 · 1 comment · Fixed by #2510
Closed

@nrwl/node:execute does not wait for app to stop #1728

pburgmer opened this issue Aug 15, 2019 · 1 comment · Fixed by #2510
Assignees
Labels
outdated scope: node Issues related to Node, Express, NestJS support for Nx type: bug

Comments

@pburgmer
Copy link

Expected Behavior

App receives SIGTERM and starts to shut down. Builder will wait for app to shut down and restart after app process has stopped.

Current Behavior

Builder sends SIGTERM to app. App starts to shut down. Builder restarts app before process has stopped.

Failure Information (for bugs)

Inspect-Port is still in use (previous process not killed yet) and therefore app restart fails.

Steps to Reproduce

I created a minimal setup to reproduce the bug. Please see https://github.com/pburgmer/nx-reproduce-restart-to-early

  • Create Workspace
  • Add Nest Application
  • Tell Nest to use shutdown hooks (in main.ts)
  • Implement long running shutdown hook (in app.service.ts)
  • Run ng serve
  • Change some code and save
  • Restart fails

Context

Node 12.6.0
MacOS 10.14.6
Nx 8.4.10

Failure Logs

app shutdown started
Starting inspector on localhost:7777 failed: address already in use
app shutdown finished

Other

Problem seems to be in packages/node/src/builders/execute/execute.impl.ts

  • function restartProcess calls killProcess
  • returned observable emits before process stopped

I guess the problem is tree-kill and not nx itself. But as tree-kill repo is very inactive and I haven't tested tree-kill in isolation, I thought it would be good to addess it here.

@jaysoo jaysoo self-assigned this Aug 16, 2019
@vsavkin vsavkin added the scope: node Issues related to Node, Express, NestJS support for Nx label Dec 12, 2019
@Cammisuli Cammisuli self-assigned this Feb 19, 2020
Cammisuli added a commit to Cammisuli/nx that referenced this issue Feb 19, 2020
Cammisuli added a commit to Cammisuli/nx that referenced this issue Feb 19, 2020
vsavkin pushed a commit that referenced this issue Feb 25, 2020
@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: node Issues related to Node, Express, NestJS support for Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants