question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

143(SIGTERM) / 130(SIGINT) instead of gracefully shutdown

See original GitHub issue

Couldn’t use nodemon with concurrently or something similar, cause If I kill npm script with nodemon, then npm outputs have errors

  • npx nodemon -v: 2.0.4
  • node -v: v14.13.0
  • Operating system/terminal environment: Arch Linux / kitty
  • Command you ran: npm run start

Expected behaviour

Successful exit without ERR from npm

Actual behaviour

[1] sleep 2 exited with code 0
--> Sending SIGTERM to other processes..
[0] npm run nodemon exited with code SIGTERM
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node@1.0.0 start: `npx concurrently -k "npm run nodemon" "sleep 2"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vlad/.npm/_logs/2020-10-10T14_28_36_051Z-debug.log

Steps to reproduce

Simple index.js:

let jobs = setInterval(() => {}, 1000)
process.on('SIGTERM', () => { jobs.unref() })

part of package.json:

"scripts": {
  "start": "npx concurrently -k \"npm run nodemon\" \"sleep 2\"",
  "nodemon": "npx nodemon ./index.js"
},
"devDependencies": {
  "concurrently": "^5.3.0",
  "nodemon": "^2.0.4"
}

Command to reproduce:

npm run start

I find the line which is the cause all of this, but i dont understand how can i workarund there

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
TomSssMcommented, Apr 12, 2021

Done some experimenting tonight, nodemon@2.0.6 works seamlessly in this scenario, so rolling back to 2.0.6 for now

EDIT: Finally figured out the problem: the reason was me saving the file and killing the process at the same time ( happens because my editor saves file on focus change ). Sorry for flooding the thread with all this monologue, for some reason I was convinced the problem was in nodemon. Hopefully this information may be helpful to someone coming across the same issue =)

0reactions
TomSssMcommented, Jul 26, 2021

By the way I still get the same issue on Mac and Windows, and I am still not entirely sure what might be causing it though it gets a little less annoying after a while

Read more comments on GitHub >

github_iconTop Results From Across the Web

SIGTERM : Linux Graceful Termination | Exit code 143, Signal ...
The SIGTERM signal provides an elegant way to terminate a program, giving it the opportunity to prepare to shut down and perform cleanup...
Read more >
Set exit code when receiving SIGTERM in Quarkus
I have read Graceful Shutdown but it does not talk about specifically ... I get an exit code of 143 upon SIGTERM, and...
Read more >
When does the system send a SIGTERM to a process?
The return code 0 means a normal exit. If there was a SIGTERM, $? would be set to 143 (128 + signal number)....
Read more >
Docker features for handling Container's death and resurrection
This is done so that the program executing inside the container can use the SIGTERM signal to do the graceful shutdown of the...
Read more >
Docker, Java, Signals and Pid 1 - no42
Some can be caught by a running process and give people possibilities to implement logic to shutdown the application gracefully.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found