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

Usage With Nodemon #75

Open
jesseweed opened this issue May 16, 2017 · 7 comments
Open

Usage With Nodemon #75

jesseweed opened this issue May 16, 2017 · 7 comments

Comments

@jesseweed
Copy link

I've notice when used a conjunction with nodemon, a new heap snapshot is written to disk every time the server restarts.

Obviously this would be less of an issue in production, but any thoughts on how to create less file pollution when running in develop mode?

Perhaps dumping the snapshots into some kind of log folder instead of the root, or possibly even an option to disable creating the file altogether?

@hhellyer
Copy link
Member

This looks like an interaction with the signal handler used for creating a heapdump. I can reproduce it without appmetrics by running with the heapdump module which appmetrics-dash includes:
> nodemon -r heapdump simplehttp.js
and typing "rs" - this creates a heap dump. I'm assuming nodemon uses a signal to restart the process it's monitoring.

(simplehttp.js just listens for http connections to keep the node process alive.)

Running with an env var which disables signal handling in heap dump seems to improve things for me:
> env NODE_HEAPDUMP_OPTIONS=nosignal nodemon -r heapdump simplehttp.js
(This works when using appmetrics-dash too.)

I think there's a bit of a clash of signal handlers here. Two modules are using them for different purposes. Does that help at all? I'll investigate a bit more to see if there's anything useful we can do here.

@tobespc
Copy link
Member

tobespc commented Jan 10, 2018

@hhellyer I'm hitting this now

@Aerex
Copy link

Aerex commented Jan 31, 2018

I would like to my piece as I am running into the same problem. @hhellyer is correct that there is a signal handling conflict. Nodemon uses SIGUSR2 to handle restarting the app and Appmetrics which uses heapdump as a dependencies uses SIGUSR2 to forcefully create a heapdump snapshot. I don't think in Node you can handle two signals at the same time

@hhellyer
Copy link
Member

hhellyer commented Feb 1, 2018

@Aerex - Does setting NODE_HEAPDUMP_OPTIONS (see above) fix the problem for you?

@Aerex
Copy link

Aerex commented Mar 5, 2018

@hhellyer It does fix the problem. Thanks for your insight. Is there another way where appmetrics doesn't use this signal for that will interfere with nodemon. I don't think setting this environment variable should be the permanent solution.

@jkingoliver
Copy link

We would like our node users to be able to use appmetrics and nodemon both and recommending that they set an env var to enable functionality doesn't seem like a good solution, I agree with @Aerex .

@hhellyer and @tobespc Can we re-open this discussion and try to find a different solution? My team is considering disabling appmetrics for local development in our tooling in order to enable hot reload with nodemon, which is an unfortunate choice.

@jkingoliver
Copy link

@hhellyer and @tobespc Following up on this issue-- is finding a better solution to the signal handling problem on your radar for 2019?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants