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

process.memoryUsage() fails when file descriptors are exhausted #83

Closed
othiym23 opened this issue Nov 14, 2013 · 1 comment
Closed

process.memoryUsage() fails when file descriptors are exhausted #83

othiym23 opened this issue Nov 14, 2013 · 1 comment
Labels

Comments

@othiym23
Copy link
Contributor

A few users of the module have encountered a condition where the memory usage sampler is failing because there are no file descriptors available. This happens with all versions of Node after 0.6.x.

Under Node 0.8.12 on Linux, process.memoryUsage() works by calling a libuv function that parses the output of /proc/self/stat. That file access is written in straight C, synchronous and coded very defensively (so many gotos…), and is tested both by benchmarking code and by burn-in tests (in Node itself).

Under Node 0.6.17, process.memoryUsage() calls a function on a Platform class defined for each supported operating system.

The sampler call in the agent acts as a sentinel of sorts – if the process has hit the maximum number of open file descriptors for the system, attempts to sample memory usage will fail. It runs once a minute, so as long as the system is starved for descriptors, it's going to trigger a new error. It's not clear to me whether it's a net win to trap the exception that gets thrown, which looks like:

Error: Too many open files
    at sampleMemory (/home/www/sites/nodechute/releases/20130220004853/node_modules/newrelic/lib/sampler.js:24:23)
    at Timer.<anonymous> (native)
    at Timer.ontimeout (timers.js:223:14)

The main reason to do so would be to prevent module users from thinking that it's the module that's causing the problem, and there's some diagnostic value in tracing that a particular error (file handle exhaustion) is happening rather than a general error (the agent can't function because the process is in a bad state).

@txase
Copy link

txase commented Jun 26, 2014

We haven't seen any recent reports of this issue, so I'm closing it out.

@txase txase closed this as completed Jun 26, 2014
cmcadams-newrelic pushed a commit to cmcadams-newrelic/node-newrelic that referenced this issue Jan 29, 2024
…12aec1d87d878e289

[Snyk] Security upgrade newrelic from 9.13.0 to 10.3.1
jsumners-nr pushed a commit to jsumners-nr/node-newrelic that referenced this issue Apr 11, 2024
jsumners-nr pushed a commit to jsumners-nr/node-newrelic that referenced this issue Apr 16, 2024
upgraded to v15 of tap and committed package-lock to repo
bizob2828 pushed a commit to bizob2828/node-newrelic that referenced this issue Apr 19, 2024
bizob2828 pushed a commit to bizob2828/node-newrelic that referenced this issue Apr 23, 2024
bizob2828 added a commit to bizob2828/node-newrelic that referenced this issue Jul 26, 2024
fixed link to support section in troubleshooting link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants