Skip to content
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

zlib deflate results in a memory leak #19

Open
jasonmcaffee opened this issue Sep 30, 2016 · 3 comments
Open

zlib deflate results in a memory leak #19

jasonmcaffee opened this issue Sep 30, 2016 · 3 comments

Comments

@jasonmcaffee
Copy link

This is a node issue, but your library uses zlib, and it causes a memory leak that has been crashing our docker containers on EC2. Unfortunately that means we can no longer use your library, and have to opt for another lib that doesn't use zlib.

It's really easy to recreate the issue:

let zlib = require('zlib');

let message = {
  some:"data"
};
let payload = new Buffer(JSON.stringify(message));

for(var i =0; i < 30000; ++i){
  zlib.deflate(payload, function (err, buffer) {
  });
}

setTimeout(()=>{}, 2000000);

Here's the related node issue:
nodejs/node#8871

@ronkorving
Copy link
Collaborator

It would be nice to make zlib optional through an option passed to the constructor. Wanna make a PR that does that?

@jasonmcaffee
Copy link
Author

@ronkorving Unfortunately I don't have the time at the moment. It would be cool to allow for various compression types (deflate, gzip, et) as well as compression levels, similar to how docker does:
https://docs.docker.com/engine/admin/logging/overview/#/gelf-options

Our quick fix is to have docker do the transporting, and removing the graylog transport from winston.

@ronkorving
Copy link
Collaborator

Graylog uses the GELF format for transporting its messages. It only supports gzip (deflate is gzip just without file headers afaik), so other formats are out of the question. GELF and compression: http://docs.graylog.org/en/2.1/pages/gelf.html#compression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants