Skip to content

Sentry's internals trigger global 'uncaughtException' on some inputs in parseStackFrames() #19408

@artur-klesun-st

Description

@artur-klesun-st

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

@sentry+core@10.39.0

Framework Version

@sentry/node: 10.39.0, @sentry/profiling-node: 10.39.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

import * as Sentry from "@sentry/node";
import { nodeProfilingIntegration } from "@sentry/profiling-node";

Sentry.init({
  dsn: "https://f15c4abb5040[REDACTED]b9353190@o4507611225522176.ingest.de.sentry.io/4508[REDACTED]3488",
  integrations: [
    nodeProfilingIntegration(),
    Sentry.consoleLoggingIntegration({}),
    //
  ],
  _experiments: { enableLogs: true },

  tracesSampleRate: 1.0,
  profilesSampleRate: 1.0,
});

Steps to Reproduce

  1. process.once('uncaughtException', (e) => ...);
  2. Keep the application running for a while until some specific situation happens that triggers this error

Expected Result

No global 'uncaughtException' caused by sentry's internal code

Actual Result

URIError: URI malformed
    at decodeURI (<anonymous>)
    at file:///app/node_modules/.pnpm/@sentry+core@10.39.0/node_modules/@sentry/core/build/esm/utils/node-stack-trace.js:93:30
    at file:///app/node_modules/.pnpm/@sentry+core@10.39.0/node_modules/@sentry/core/build/esm/utils/stacktrace.js:42:23
    at parseStackFrames (file:///app/node_modules/.pnpm/@sentry+core@10.39.0/node_modules/@sentry/core/build/esm/utils/eventbuilder.js:10:10)
    at exceptionFromError (file:///app/node_modules/.pnpm/@sentry+core@10.39.0/node_modules/@sentry/core/build/esm/utils/eventbuilder.js:44:18)
    at eventFromUnknownInput (file:///app/node_modules/.pnpm/@sentry+core@10.39.0/node_modules/@sentry/core/build/esm/utils/eventbuilder.js:160:16)
    at NodeClient.eventFromException (file:///app/node_modules/.pnpm/@sentry+core@10.39.0/node_modules/@sentry/core/build/esm/server-runtime-client.js:38:19)
    at file:///app/node_modules/.pnpm/@sentry+core@10.39.0/node_modules/@sentry/core/build/esm/client.js:247:14
    at Object.add (file:///app/node_modules/.pnpm/@sentry+core@10.39.0/node_modules/@sentry/core/build/esm/utils/promisebuffer.js:43:18)
    at NodeClient._process (file:///app/node_modules/.pnpm/@sentry+core@10.39.0/node_modules/@sentry/core/build/esm/client.js:885:30)

Additional Context

I don't have much information since this error happens inside of the sentry core and is only reaching my app via process.once('uncaughtException', (e) => ...);. If you have sourcemaps for this build, you can probably narrow down where this uncaught exception is thrown.

Surprisingly, nobody reported it yet, probably reproduces on some very specific exceptions like with some special characters in file paths.

This leaking uncaughtException is very problematic since in nodejs environment the default behaviour is to terminate the application when this global event fires.

We are running our app with tsx. Maybe that could be what makes paths in the parsed stack trace invalid urls.

command: [
    'node',
    '--import',
    './instrument.mjs',
    '--import',
    'tsx/esm',
    'src/tasks/workers/all-workers.starter.ts',
  ]

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions