Comments (6)
@remy I don't think this issue should be closed. I can still reproduce this, even in both Rancher Desktop:
[+] Building 6.8s (9/9) FINISHED docker:default
=> [node internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 136B 0.0s
=> [node internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [node internal] load metadata for docker.io/library/node:18-bu 3.2s
=> [node 1/4] FROM docker.io/library/node:18-bullseye-slim@sha256 0.0s
=> [node internal] load build context 0.0s
=> => transferring context: 223B 0.0s
=> CACHED [node 2/4] WORKDIR /app 0.0s
=> [node 3/4] COPY package.json . 0.0s
=> [node 4/4] RUN npm i 3.4s
=> [node] exporting to image 0.1s
=> => exporting layers 0.1s
=> => writing image sha256:de8b0b784c881e29f92bab03ea83ca6de2f317 0.0s
=> => naming to docker.io/library/mcve-nodemon-docker-exit-node 0.0s
[+] Running 2/1
✔ Network mcve-nodemon-docker-exit_default Created 0.3s
✔ Container mcve-nodemon-docker-exit-node-1 Created 0.0s
Attaching to node-1
> start
> DEBUG=nodemon,nodemon:* nodemon src/script.js
2024-01-25T08:34:35.886Z nodemon bus new listener: reset (0)
2024-01-25T08:34:35.887Z nodemon bus new listener: reset (0)
2024-01-25T08:34:35.891Z nodemon bus new listener: quit (0)
2024-01-25T08:34:35.891Z nodemon bus new listener: quit (0)
2024-01-25T08:34:35.891Z nodemon bus new listener: restart (0)
2024-01-25T08:34:35.892Z nodemon bus new listener: restart (0)
2024-01-25T08:34:35.892Z nodemon bus new listener: boot (0)
2024-01-25T08:34:35.892Z nodemon bus new listener: boot (0)
2024-01-25T08:34:35.894Z nodemon bus new listener: reset (2)
2024-01-25T08:34:35.896Z nodemon bus emit: boot
2024-01-25T08:34:35.896Z nodemon bus emit: reset
2024-01-25T08:34:35.896Z nodemon resetting watchers
2024-01-25T08:34:35.896Z nodemon reset
2024-01-25T08:34:35.914Z nodemon config: dirs [ '/app' ]
[nodemon] 3.0.3
[nodemon] to restart at any time, enter `rs`
2024-01-25T08:34:35.920Z nodemon bus new listener: error (0)
2024-01-25T08:34:35.920Z nodemon bus new listener: error (0)
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting `node src/script.js`
2024-01-25T08:34:35.929Z nodemon:run fork sh -c node src/script.js
2024-01-25T08:34:35.929Z nodemon bus new listener: exit (0)
2024-01-25T08:34:35.930Z nodemon bus new listener: exit (0)
2024-01-25T08:34:35.930Z nodemon:run start watch on: [ '*.*', re: /.*\..*/ ]
2024-01-25T08:34:35.931Z nodemon start watch on: /app
2024-01-25T08:34:35.931Z nodemon ignored [
'**/.git/**',
'**/.nyc_output/**',
'**/.sass-cache/**',
'**/bower_components/**',
'**/coverage/**',
'**/node_modules/**',
re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/
]
2024-01-25T08:34:35.947Z nodemon:watch chokidar watching: /app/package-lock.json
2024-01-25T08:34:35.947Z nodemon:watch chokidar watching: /app/package.json
2024-01-25T08:34:35.955Z nodemon:watch chokidar watching: /app/src/script.js
2024-01-25T08:34:35.955Z nodemon watch is complete
Hello world!
2024-01-25T08:34:35.974Z nodemon:run bus.emit(exit) via SIGUSR2
2024-01-25T08:34:35.974Z nodemon bus emit: exit
[nodemon] clean exit - waiting for changes before restart
^CGracefully stopping... (press Ctrl+C again to force)
[+] Stopping 1/1
✔ Container mcve-nodemon-docker-exit-node-1 Stopped 10.5s
node-1 exited with code 0
canceled
…and OrbStack:
[+] Building 0.6s (9/9) FINISHED docker:orbstack
=> [node internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 136B 0.0s
=> [node internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [node internal] load metadata for docker.io/library/node:18-b 0.6s
=> [node 1/4] FROM docker.io/library/node:18-bullseye-slim@sha25 0.0s
=> [node internal] load build context 0.0s
=> => transferring context: 34B 0.0s
=> CACHED [node 2/4] WORKDIR /app 0.0s
=> CACHED [node 3/4] COPY package.json . 0.0s
=> CACHED [node 4/4] RUN npm i 0.0s
=> [node] exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:d43b6b2309d5b15cf112821bf56f77dea4337 0.0s
=> => naming to docker.io/library/mcve-nodemon-docker-exit-node 0.0s
[+] Running 1/0
✔ Container mcve-nodemon-docker-exit-node-1 Created 0.0s
Attaching to node-1
> start
> DEBUG=nodemon,nodemon:* nodemon src/script.js
2024-01-25T08:42:00.234Z nodemon bus new listener: reset (0)
2024-01-25T08:42:00.235Z nodemon bus new listener: reset (0)
2024-01-25T08:42:00.239Z nodemon bus new listener: quit (0)
2024-01-25T08:42:00.240Z nodemon bus new listener: quit (0)
2024-01-25T08:42:00.240Z nodemon bus new listener: restart (0)
2024-01-25T08:42:00.240Z nodemon bus new listener: restart (0)
2024-01-25T08:42:00.240Z nodemon bus new listener: boot (0)
2024-01-25T08:42:00.240Z nodemon bus new listener: boot (0)
2024-01-25T08:42:00.241Z nodemon bus new listener: reset (2)
2024-01-25T08:42:00.242Z nodemon bus emit: boot
2024-01-25T08:42:00.242Z nodemon bus emit: reset
2024-01-25T08:42:00.242Z nodemon resetting watchers
2024-01-25T08:42:00.242Z nodemon reset
2024-01-25T08:42:00.261Z nodemon config: dirs [ '/app' ]
[nodemon] 3.0.3
[nodemon] to restart at any time, enter `rs`
2024-01-25T08:42:00.264Z nodemon bus new listener: error (0)
2024-01-25T08:42:00.265Z nodemon bus new listener: error (0)
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting `node src/script.js`
2024-01-25T08:42:00.272Z nodemon:run fork sh -c node src/script.js
2024-01-25T08:42:00.272Z nodemon bus new listener: exit (0)
2024-01-25T08:42:00.272Z nodemon bus new listener: exit (0)
2024-01-25T08:42:00.272Z nodemon:run start watch on: [ '*.*', re: /.*\..*/ ]
2024-01-25T08:42:00.273Z nodemon start watch on: /app
2024-01-25T08:42:00.273Z nodemon ignored [
'**/.git/**',
'**/.nyc_output/**',
'**/.sass-cache/**',
'**/bower_components/**',
'**/coverage/**',
'**/node_modules/**',
re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/
]
2024-01-25T08:42:00.286Z nodemon:watch chokidar watching: /app/package-lock.json
2024-01-25T08:42:00.286Z nodemon:watch chokidar watching: /app/package.json
2024-01-25T08:42:00.291Z nodemon:watch chokidar watching: /app/src/script.js
2024-01-25T08:42:00.292Z nodemon watch is complete
Hello world!
2024-01-25T08:42:00.304Z nodemon:run bus.emit(exit) via SIGUSR2
2024-01-25T08:42:00.304Z nodemon bus emit: exit
[nodemon] clean exit - waiting for changes before restart
^CGracefully stopping... (press Ctrl+C again to force)
[+] Stopping 1/1
✔ Container mcve-nodemon-docker-exit-node-1 Stopped 10.1s
node-1 exited with code 0
canceled
from nodemon.
I'm seeing the same behavior in a standard docker compose setup at the moment. I've also been able to reproduce the issue with @hdodov's mcve repository and tried adapting it to run a minimal express app that also listens for SIGINT and SIGTERM signals during runtime, neither of which seem to reach the application.
from nodemon.
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3
from nodemon.
My guess is that the sub process isn't shutting down when you send the ctrl+c (which is received by nodemon) so nodemon has a grace period (of 10 seconds polling the sub process) after which it forcibly exits.
Wonder if running your docker instance with env value DEBUG=nodemon,nodemon:*
and it might give us insights into what's actually hanging.
from nodemon.
@remy here's the debug output you suggested:
$ npm run dev
> dev
> docker compose up --build --no-log-prefix
[+] Building 0.1s (9/9) FINISHED docker:desktop-linux
=> [node internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [node internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 136B 0.0s
=> [node internal] load metadata for docker.io/library/node:18-bullseye-slim 0.0s
=> [node 1/4] FROM docker.io/library/node:18-bullseye-slim 0.0s
=> [node internal] load build context 0.0s
=> => transferring context: 34B 0.0s
=> CACHED [node 2/4] WORKDIR /app 0.0s
=> CACHED [node 3/4] COPY package.json . 0.0s
=> CACHED [node 4/4] RUN npm i 0.0s
=> [node] exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:deb343f642d0dcd9868a5438fa728fa2cd0ea0ff09921c49b089b51be0855b05 0.0s
=> => naming to docker.io/library/mcve-nodemon-docker-exit-node 0.0s
[+] Running 1/0
✔ Container mcve-nodemon-docker-exit-node-1 Created 0.0s
Attaching to mcve-nodemon-docker-exit-node-1
> start
> DEBUG=nodemon,nodemon:* nodemon src/script.js
2024-01-04T09:26:24.937Z nodemon bus new listener: reset (0)
2024-01-04T09:26:24.938Z nodemon bus new listener: reset (0)
2024-01-04T09:26:24.942Z nodemon bus new listener: quit (0)
2024-01-04T09:26:24.942Z nodemon bus new listener: quit (0)
2024-01-04T09:26:24.942Z nodemon bus new listener: restart (0)
2024-01-04T09:26:24.942Z nodemon bus new listener: restart (0)
2024-01-04T09:26:24.943Z nodemon bus new listener: boot (0)
2024-01-04T09:26:24.943Z nodemon bus new listener: boot (0)
2024-01-04T09:26:24.944Z nodemon bus new listener: reset (2)
2024-01-04T09:26:24.945Z nodemon bus emit: boot
2024-01-04T09:26:24.946Z nodemon bus emit: reset
2024-01-04T09:26:24.946Z nodemon resetting watchers
2024-01-04T09:26:24.946Z nodemon reset
2024-01-04T09:26:24.964Z nodemon config: dirs [ '/app' ]
[nodemon] 3.0.2
[nodemon] to restart at any time, enter `rs`
2024-01-04T09:26:24.967Z nodemon bus new listener: error (0)
2024-01-04T09:26:24.968Z nodemon bus new listener: error (0)
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting `node src/script.js`
2024-01-04T09:26:24.977Z nodemon:run fork sh -c node src/script.js
2024-01-04T09:26:24.977Z nodemon bus new listener: exit (0)
2024-01-04T09:26:24.977Z nodemon bus new listener: exit (0)
2024-01-04T09:26:24.978Z nodemon:run start watch on: [ '*.*', re: /.*\..*/ ]
2024-01-04T09:26:24.978Z nodemon start watch on: /app
2024-01-04T09:26:24.979Z nodemon ignored [
'**/.git/**',
'**/.nyc_output/**',
'**/.sass-cache/**',
'**/bower_components/**',
'**/coverage/**',
'**/node_modules/**',
re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/
]
2024-01-04T09:26:24.992Z nodemon:watch chokidar watching: /app/package-lock.json
2024-01-04T09:26:24.992Z nodemon:watch chokidar watching: /app/package.json
2024-01-04T09:26:24.994Z nodemon:watch chokidar watching: /app/src/script.js
2024-01-04T09:26:24.995Z nodemon watch is complete
Hello world!
[nodemon] clean exit - waiting for changes before restart
2024-01-04T09:26:25.011Z nodemon:run bus.emit(exit) via SIGUSR2
2024-01-04T09:26:25.011Z nodemon bus emit: exit
^CGracefully stopping... (press Ctrl+C again to force)
Aborting on container exit...
[+] Stopping 1/1
✔ Container mcve-nodemon-docker-exit-node-1 Stopped 10.1s
canceled
I've updated the reproduction repo to include the DEBUG
variable, so you can try it on your machine as well.
I don't know if this output is useful because nothing actually gets logged after pressing Ctrl + C (the line beginning with ^C
). That's when the delay occurs.
from nodemon.
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3
from nodemon.
Related Issues (20)
- Cannot read properties of undefined (reading 'filename') in Node v20.6.0 (yarn2) HOT 7
- nodemon can not be stopped by Ctrl-C with --no-stdin after restart with terminal in raw mode HOT 10
- catch global error not working HOT 1
- ignore everything except repeated specific sub directories HOT 3
- Old version of `debug` dependency introduces `CVE-2017-16137` vulnerability HOT 1
- Workflows failing - not even getting to tests… HOT 2
- I need some assistance. it‘s not a bug but I didn't find the discussion tag. So I have to raise a question as an issue:does nodemon support running ts files? HOT 5
- Issue on a dependency - CVE-2022-25883 HOT 3
- Nodemon support for native .env file loading (Remy edit: was always supported) HOT 7
- nodemon called as a subprocess within a subprocess breaks stdin after SIGINT HOT 5
- Nodemon TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" HOT 4
- Nodemon the `punycode` module is deprecated in node js 21 HOT 2
- ts-node should not be default when `--import` flag is present HOT 6
- [Feature Request] Add a quit (repl) command HOT 7
- says server restarting but changes are not reflected on the terminal HOT 13
- - `nodemon -v`:
- Nodemon config file different than json HOT 4
- New Feature Request : adding a very simple way to handle node projects with ES Module HOT 2
- Nodemon Getting Stuck in the Restarting Phase HOT 24
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodemon.