Skip to content

EMFILE: too many open files, uv_resident_set_memory in _updateContext #9507

Closed
@ghost

Description

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

7.77.0

Framework Version

Next 14.0.1

Link to Sentry event

https://sentry.io/organizations/thinkaidium/issues/4598335869/?project=4504118550528000&referrer=github_integration

SDK Setup

client:

init({
    dsn: SENTRY_DSN,
    environment: process.env['ENVIRONMENT'],
    tracesSampleRate: 0.1,

    // This sets the sample rate to be 10%. You may want this to be 100% while
    // in development and sample at a lower rate in production
    replaysSessionSampleRate: 0.1,
    // If the entire session is not sampled, use the below sample rate to sample
    // sessions when an error occurs.
    replaysOnErrorSampleRate: 1.0,
    integrations: [new Replay()],
  });

edge:

init({
    dsn: SENTRY_DSN,
    environment: process.env['ENVIRONMENT'],
    tracesSampleRate: 0.1,
  });

server:

init({
    dsn: SENTRY_DSN,
    environment: process.env['ENVIRONMENT'],
    tracesSampleRate: 0.1,
  });

Steps to Reproduce

I'm not sure. You can get the call stack from the sentry link attached.

node:internal/process/per_thread in process.memoryUsage at line 172:5
/var/task/node_modules/@sentry/node/cjs/integrations/context.js in Context._updateContext at line 76:41
/var/task/node_modules/@sentry/node/cjs/integrations/context.js in Context.addContext at line 56:33

After a bit of a research from my side, I see that the community uses 'graceful-fs'/'node-fs-extra' instead of 'fs' to prevent EM File errors.

Expected Result

No errors?

Actual Result

Throws this error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Type

    No type

    Projects

    Status

    No status

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions