Test script for issue #104 (with fix/workaround)#157
Test script for issue #104 (with fix/workaround)#157danielweck wants to merge 9 commits intoZJONSSON:masterfrom danielweck:issue-104
Conversation
|
The bug occurs randomly, so it can take a few tries to observe it. Sometimes it triggers immediately. I use the following CLI to repeat the process:
CLI arguments:
|
|
Here is an example output (MacOS): Note that each dot
|
|
Another hit: Note that this is with a single iteration instead of
|
|
I managed to reproduce the issue for a single ZIP file (which eliminates the possibility of folder scanning being a factor). See output below. Note that this PR includes
|
|
I implemented a fix by replacing The PR commit which introduces this change: Note that the Caveat: the raw file descriptor must be manually closed, thus the introduction of a new |
|
Awesome @danielweck thank you so much for doing this!! I'm still keeping backward compatibility on the basis that |
|
I see: This wasn't intended to provide a robust, properly thought-out solution. By process of elimination, I came up with the conclusion that Most notably, this PR introduces a "breaking change" in that the This lifecycle pattern is actually aligned with the two other well-known performant implementations Plus, my implementation is kinda dirty, as you can see I attach the |
|
Thanks @danielweck this is very helpful. Of course we could close fd automatically if it hasn't been used for a small amount of time (and reopen if it has been closed if/when we need it again, i.e. caching the fd temporarily based on last-touch). That should make the behavior backwards compatible, i.e. explicit close would not be required, but slightly more hacky. Will take a closer look this weekend |
|
Is there any progress? @ZJONSSON |
#104 (comment)
Stacktrace / debug info:
node --version=>
v10.16.3https://github.com/nodejs/node/blob/v10.16.3/lib/fs.js#L467
https://github.com/nodejs/node/blob/v10.16.3/lib/internal/fs/streams.js#L165