-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
event emitter leak in compression #58
Comments
Calling |
Looks like Node.js has never fixed this issue yet. Here is a PR to Node.js core to fix: nodejs/node-v0.x-archive#25679 |
Hmm, I am running v.4.2.1 on armv6l |
@usernameisalreadytaken2014 , correct, it is not fixed. There is a PR to fix this in Node.js core: nodejs/node-v0.x-archive#25679 if you want to get them to accept the patch :) |
Hmm okay then. I left a note over in the nodejs tracker. Fingers crossed |
Here is my keep-alive function.
Used on top of a HTTP response that delivers a stream of JSON updates, formatted as text/event-stream (hence the flush).
The keep-alive is useful for SSE streams that only update once in a while, such as transmitting new data points on graphs that have only one data point per minute.
Usually there is a (network) router or two among the hops between client and server, that has a TCP state table with a timeout of 30 seconds, so the above helps to keep the channel open until the next event is ready for the client.
The expressjs/compression module, when enabled, has this side effect:
I'm not adding any event listeners, however. Just flushing the output stream after writing.
Hmm, thinking about it, the keep-alive function is irrelevant. When using text/event-stream, the first big chunk of data will usually be pushed with just a single flush at the end, but once the stream gets "up to date" or whatever, every complete JSON object written will be followed by a flush().
Probably just random chance that this happened to me inside the keep-alive function...
Anyway, the error disappears if the compression module is disabled.
The text was updated successfully, but these errors were encountered: