You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to point out that the problem is not one-to-one. That is, not every request gets stuck in memory. After dozens of requests, only one object can be added, and sometimes more. I didn't find any particular pattern.
You may notice that multiple hubs are created, and the data (in locals) is not removed from the response object (and the response object is not deleted either).
if remove app.use(Sentry.Handlers.requestHandler());, there are no memory issues.
Reacted by Kamil Chlebek, Sarunas Tamasauskas, aleserche, Andrey Reshetnikov, Dima Zabello and Tomas Kislan
Unfortunately this is going to be quite hard to figure out without a reproducible example. Any chance you could provide one?
It's definitely not easy... I'll try to do it.
Are you creating multiple hubs on purpose? Or is this just something you observed with the single Sentry.init call you mentioned in the issue?
Second option. Just regular integration with express.js. As far as I remember, only one hub should be created for the entire application, is it correct?
Since the application is small, catching this issue is even more difficult. Dozens of requests with different intensities with several snapshots, and I managed to reproduce it. Good luck with this.
As you said it's next.js so we don't configure it for express
Apologies, I completely missed this in your first comment.
Unfortunately, I think we're talking about multiple different memory leaks and scenarios by now. The only reproduction we received so far was for the Node SDK which no longer leaks memory if the order of registering the Sentry Node/Express handlers is corrected. Furthermore, users are mentioning different version ranges when the leak started happening.
If you're able to provide a minimal reproduction for the leak you experience in your NextJS, we'd greatly appreciate it!
What Node version is everyone using? What SDK features is everyone using (errors, performance, profiling, etc.). For Next.js in particular are you using the app or pages router?
Because of the variety of different permutations of possible setups, sharing your package.json, next.config.js, etc. would be extremely helpful to allow us to narrow this down!
Considering we now have a new major version that made some improvements here (8.0.0), and we've also done some work to address memory issues there, I think the recommendation is to upgrade your SDK to v8:
Activity
Lms24 commentedon Feb 23, 2024
Hey @xr0master thanks for writing in!
Unfortunately this is going to be quite hard to figure out without a reproducible example. Any chance you could provide one?
Another question:
Are you creating multiple hubs on purpose? Or is this just something you observed with the single
Sentry.initcall you mentioned in the issue?xr0master commentedon Feb 23, 2024
Hey @Lms24
It's definitely not easy... I'll try to do it.
Second option. Just regular integration with express.js. As far as I remember, only one hub should be created for the entire application, is it correct?
xr0master commentedon Feb 23, 2024
@Lms24
https://github.com/xr0master/sentry-memo-leak
get request
http://localhost:5001/logsSince the application is small, catching this issue is even more difficult. Dozens of requests with different intensities with several snapshots, and I managed to reproduce it. Good luck with this.
65 remaining items
Lms24 commentedon Apr 22, 2024
Apologies, I completely missed this in your first comment.
Unfortunately, I think we're talking about multiple different memory leaks and scenarios by now. The only reproduction we received so far was for the Node SDK which no longer leaks memory if the order of registering the Sentry Node/Express handlers is corrected. Furthermore, users are mentioning different version ranges when the leak started happening.
If you're able to provide a minimal reproduction for the leak you experience in your NextJS, we'd greatly appreciate it!
sarunast commentedon Apr 24, 2024
Perhaps it is @Lms24 but what caught my attention was this comment:
Which is true for us.
AbhiPrasad commentedon Apr 24, 2024
Looking at https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#71000
The related changes are:
requirecall to import Undici #10388)What Node version is everyone using? What SDK features is everyone using (errors, performance, profiling, etc.). For Next.js in particular are you using the app or pages router?
Because of the variety of different permutations of possible setups, sharing your
package.json,next.config.js, etc. would be extremely helpful to allow us to narrow this down!lforst commentedon Apr 25, 2024
@AbhiPrasad I think it is this change where we introduce strong references to scopes on spans #10492
AbhiPrasad commentedon Nov 1, 2024
Considering we now have a new major version that made some improvements here (
8.0.0), and we've also done some work to address memory issues there, I think the recommendation is to upgrade your SDK to v8:https://docs.sentry.io/platforms/javascript/guides/node/migration/v7-to-v8/
Closing this issue for now as such.