-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
memory leak #431
Comments
You can add all the other bundled plugins with the order specified in the docs and the behavior is still the same. I also tried Node versions 0.10.16 and 0.8.25 with similar results. |
Hmm, that's interesting. I'll take a look, but sadly I'm on the road a On Wed, Aug 21, 2013 at 2:57 PM, Ryan Pedela notifications@github.comwrote:
|
Okay. Yeah I plan to dig deeper into exactly where it is. |
If I were to guess, something is holding node buffers. If you haven't On Wed, Aug 21, 2013 at 3:25 PM, Ryan Pedela notifications@github.comwrote:
|
Cool, thanks. I will take a look at SmartOS. |
I used node-heapdump and looked at the dumps using Chrome. I took a heap snapshot in the With only gzip response With only body parser I am not too experienced looking at heap retaining trees, but hopefully I have pointed you in the right direction. |
Digging deeper with the gzip case, I think it has to do with all the circular binding going on. I commented out all the |
So, is the bodyParser leaking as well or is it just GZIP? I should have On Fri, Aug 23, 2013 at 5:47 PM, Ryan Pedela notifications@github.comwrote:
|
I think bodyParser has a bug where the current request keeps a reference to the previous response. The memory is eventually freed though. Gzip creates a leak that keeps growing. I have worked around the gzip bug by compressing the responses myself. |
Spent some time trying to track this down in production. I can verify that gzip looks to be the culprit. I haven't had a moment to dig into the plugin yet though. |
Update for v2.6.2:
|
Scratch that. Turns out it was node-newrelic (the tool I was using to monitor) that was causing the leak. Restify appears fine in my tests! |
I was able to reproduce this memory leak with a minor adjustment. I am switching back to express until this is resolved. I will paste the test code below. You can test the results with restify and also enable express to see the difference. var fs = require('fs'); var hd = null; function startDiff(req, res, next) { function endDiff(req, res, next) {
} var server = restify.createServer(); // removing either plugin also exhibits the memory leak var filename = path.join(__dirname,'../../data/Microsoft_Press_eBook_Programming_Windows_Store_Apps_2nd_Edition_2nd_Preview.pdf'); server.get('/', [ server.listen(4001, function() { |
Btw, I was using 2.7.0 and upgraded to 2.8.1 due to the same issue. |
Has this problem been solved? Thanks |
Haven't heard anything further regarding a potential memory leak in the Gzip Response plugin. Please re-open if this is still an issue. |
While old, I don't think it is appropriate to just close this issue. Memory leaks are one of those bugs/issues that are assumed a problem until proven otherwise. No one saying anything for awhile is not proof that the leak is fixed. In this case, it is really easy to see if the memory leak still exists. Run my test code above against the latest version and see if it still leaks. |
Re-opened and assigned to myself. I'll take a look for the upcoming release. |
Thank you, @rpedela . We'll take a look and see if the issue still exists. I apologize for closing the issue without checking if it was still a problem. |
I'm not seeing this happen in node 4.x. Using the example code above (and migrating to memwatch-next): $ node gzip.js
listening at http://[::]:4001
before: 7.16 mb
after: 32.18 mb
change: 25.02 mb
---------------------
before: 7.35 mb
after: 32.35 mb
change: 25 mb
---------------------
before: 7.36 mb
after: 32.36 mb
change: 25 mb
---------------------
before: 7.36 mb
after: 32.36 mb
change: 25 mb
---------------------
before: 7.37 mb
after: 32.37 mb
change: 25 mb
---------------------
before: 7.38 mb
after: 32.38 mb
change: 25 mb
--------------------- |
I had similar issue on version 2.7.0. The issue was resolved by upgrading to 5.0.0-beta1. |
This sounds like it is resolved in v5 of node running on Node.js v4 and greater. If you are still running into this, please comment and we can re-visit! ❤️ |
I am pretty sure I found a major memory leak. It seems to be related to the
gzipResponse
andbodyParser
plugins. I use node-memwatch to inspect the memory usage and force a garbage collection.Version Info
Server
Client
Output after 3 client calls, with memory leak
Output after 3 client calls, with no memory leak
The text was updated successfully, but these errors were encountered: