Skip to content

Sentry.captureException doesn't close readable stream opened by createReadStream in getContextLinesFromFile #14892

Closed
@mstrokin

Description

@mstrokin

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

8.47.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

https://github.com/mstrokin/sentry-openfiles-bug

Steps to Reproduce

Running this in a Node Express server opens same files repeatedly without ever closing them, since 8.10.0 (8.9.0 works fine).

for (var i = 0; i < 1000; i++) {
Sentry.captureException('fake exception to test the files opening');
}

This is the cause of it: #12221

const stream = createReadStream(path);

this stream never gets closed (even though it supposed to use autoClose I think)

Expected Result

There are no open files in lsof output after sending the exceptions.

Actual Result

New files are opened every time captureException is called.

Metadata

Metadata

Assignees

Labels

Package: nodeIssues related to the Sentry Node SDK

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions