Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
9.2.0
Framework Version
Node 20.16.3
Link to Sentry event
No response
Reproduction Example/SDK Setup
We're seeing a Sentry-related memory leak in an Express web server. I suspect the leak has been present for quite some time, but it became more apparent recently when we started attaching large objects (a couple hundred KB to a few MB) to some of our Express requests.
The issue feels similar to #14965, but the retention stack is slightly different, and the issue was not resolved by upgrading to the latest version of the SDK. Feel free to mark as duplicate and reopen there.
Versions:
- Node: 20.16.3
- Sentry SDK: 9.2.0
- Express: 4.21.2
Sentry usage -- fairly vanilla initialization:
Sentry.init({
dsn: process.env.SENTRY_DSN,
release: process.env.VERSION,
environment: process.env.ENV_NAME,
integrations: [
nodeProfilingIntegration(),
],
});
const app = express();
Sentry.setupExpressErrorHandler(app);
/* Other express app setup */
Adding a touch of context in some other error handling middleware, leak is still present if I remove this:
if (user) {
Sentry.setUser({
id: user.id ? user.id : user.toString(),
username: user.name && `${user.name.first} ${user.name.last}`,
email: user.email,
});
}
Unfortunately I can't provide a full heapdump or source code from our app to reproduce.
Steps to Reproduce
Sorry, I know how frustrating it is to not get perfect reproduction steps, but I can't share source code. I can take a stab at a minimal reproducing setup if I have some spare time. I'd start by:
- Creating an Express app that attaches some large objects to requests
- Occasionally throwing errors to be caught by Sentry
- Running some non-trivial request load
Expected Result
Flat memory usage
Actual Result
Rising memory usage. Sentry 7.12x.x version is 7.120.1:
Metadata
Metadata
Assignees
Type
Projects
Status