Line reader doesn't close open files, results in "too many open files" error. #32

Closed
opened 2012-07-06 17:26:28 -07:00 by jarod2d · 2 comments
jarod2d commented 2012-07-06 17:26:28 -07:00 (Migrated from github.com)

Line readers open files but don't ever close them. If you create enough line readers you'll get the error EMFILE, too many open files. The files need to be closed to avoid this.

There isn't really a way for the line reader to close the file automatically because it doesn't know when the user is done with it, so the user will need to close the file themselves. Currently they can do so by doing something like fs.closeSync(reader.fd), but this isn't documented -- they'll need to look at the source to know that they can grab the file descriptor from the reader.

This should be documented in the readme, and perhaps a function should be added to the line reader that performs the close for you.

Line readers open files but don't ever close them. If you create enough line readers you'll get the error `EMFILE, too many open files`. The files need to be closed to avoid this. There isn't really a way for the line reader to close the file automatically because it doesn't know when the user is done with it, so the user will need to close the file themselves. Currently they can do so by doing something like `fs.closeSync(reader.fd)`, but this isn't documented -- they'll need to look at the source to know that they can grab the file descriptor from the reader. This should be documented in the readme, and perhaps a function should be added to the line reader that performs the close for you.
ryanmcgrath commented 2012-11-09 02:17:50 -08:00 (Migrated from github.com)

Done. 4 months late, but done.

Done. 4 months late, but done.
jarod2d commented 2012-11-09 10:36:36 -08:00 (Migrated from github.com)

Awesome, thanks!

Awesome, thanks!
This repository is archived. You cannot comment on issues.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: code/wrench-js#32
No description provided.