glebec/send-seekable

Error: EMFILE: too many open files happened

Closed this issue · 2 comments

Error: EMFILE: too many open files happened

return stream.pipe(res);

Maybe change to below code can resolve this problem
https://github.com/jshttp/on-finished

stream.pipe(res)
onFinished(res, function (err) {
    destroy(stream)
});

take this load test for this case

./wrk -c 200 -d 30 -t 12 -v http://localhost:9000/0e16c56a28a4ea5aa7b6d40b09ce1b9b.mp4

@poppop0911 can you explain your test case (./wrk -c 200 -d 30 -t 12 -v http://localhost:9000/0e16c56a28a4ea5aa7b6d40b09ce1b9b.mp4) a bit more? I'd like to implement a fix but to do so I will need to reproduce the issue you're having so I can confirm that any new code helps.

Conversely you are of course welcome to submit a PR including tests.

https://github.com/meloncholy/vid-streamer

This happens in the above project.
But I still can not confirm that occurred in this project,
But if the requested stream is interrupted, it will automatically shut down the input stream, or cause the input stream to not be effectively closed, still can not confirm, some sorry