-
Notifications
You must be signed in to change notification settings - Fork 117
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
Error: EBADF: bad file descriptor, read when parsing over Open.file() #104
Comments
it looks like the problem is in using promise inside the while. I just tested with the simple forEach and it works fine. I wanted to prevent memory leakage. But it seems that's the reason. |
Dear @ThePlenkov I had same the problem. The way I solved was through comment in Node source (based on 10.15.0). Try modifying your code like this: const stream = oFile
.stream()
.pipe(oFileNew)
.on("finish", () => {
setTimeout(() => stream, 100); // Below 70, the problem still occurred.
resolve();
})
.on("error", reject); But, I do not know if the magic number Thank you for reading my comment. |
@DavinAhn haha, nice!)) |
I have the same issue and I believe the issue should be open until solved. |
I am able to reproduce this random |
Same story here. @danielweck can you share example with |
Stacktrace / debug info:
https://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
|
Thanks @danielweck - can you give me more detail on how I can also replicate the problem on my side, i.e. your test suite, do you have a branch or a commit hash I can run tests that fail? Would be really valuable to get to the bottom of this and fix it. It's worth noting that the unzipper.Parse is the legacy implementation within |
See #157 |
Here is a repro script which can be used to compare I should point out that I tried various node-unzipper/lib/Open/index.js Lines 24 to 28 in b0e3d93
The bug does not occur consistently, and is therefore hard to reproduce. Which is why a repro script comes-in handy. I suspect that devs who tried the On the other hand, I have never managed to make
|
Just a thought: node-unzipper/lib/Open/index.js Line 27 in b0e3d93
Conversely, https://github.com/antelle/node-stream-zip/blob/master/node_stream_zip.js#L165 https://github.com/thejoshwolfe/yauzl/blob/02a5ca69c7713f6d2897cc02f2acc1df21093e3d/index.js#L33
|
Quick follow-up: I've replace
|
I updated my pull request with a possible fix / workaround: |
Any workarounds without changes to the library? |
Based on my experience ; i.e. empirical results from stress-testing the |
`unzipper` would throw an FD error occationaly. Relevant issue: ZJONSSON/node-unzipper#104 There is a pending PR, but it seemed simpler to simply move to `yauzl`. The error: ``` events.js:174 throw er; // Unhandled 'error' event ^ Error: EBADF: bad file descriptor, read Emitted 'error' event at: at lazyFs.read (internal/fs/streams.js:165:12) at FSReqWrap.wrapper [as oncomplete] (fs.js:467:17) ```
`unzipper` would throw an FD error occasionally. Relevant issue: ZJONSSON/node-unzipper#104 There is a pending PR, but it seemed simpler to simply move to `yauzl`. The error: ``` events.js:174 throw er; // Unhandled 'error' event ^ Error: EBADF: bad file descriptor, read Emitted 'error' event at: at lazyFs.read (internal/fs/streams.js:165:12) at FSReqWrap.wrapper [as oncomplete] (fs.js:467:17) ```
`unzipper` would throw an FD error occasionally. Relevant issue: ZJONSSON/node-unzipper#104 There is a pending PR, but it seemed simpler to simply move to `yauzl`. The error: ``` events.js:174 throw er; // Unhandled 'error' event ^ Error: EBADF: bad file descriptor, read Emitted 'error' event at: at lazyFs.read (internal/fs/streams.js:165:12) at FSReqWrap.wrapper [as oncomplete] (fs.js:467:17) ```
`unzipper` would throw an FD error occasionally. Relevant issue: ZJONSSON/node-unzipper#104 There is a pending PR, but it seemed simpler to simply move to `yauzl`. The error: ``` events.js:174 throw er; // Unhandled 'error' event ^ Error: EBADF: bad file descriptor, read Emitted 'error' event at: at lazyFs.read (internal/fs/streams.js:165:12) at FSReqWrap.wrapper [as oncomplete] (fs.js:467:17) ```
Dear @ZJONSSON
Thank you for Open.file() which saves actually a lot of time . However most of times I have a very strange error. The problem is - it's very random, always raising after different files:
Here is the sample code how I use it:
this is the reference to the file: https://tools.hana.ondemand.com/additional/sapui5-rt-1.44.42.zip
Do you have any ideas what it can be?
THank you!
The text was updated successfully, but these errors were encountered: