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
Handle closing the file descriptors in Node 20.x.x when work with streams #1690
Comments
Hi @10kc-svats , could you try and see if 96d6e76 (#1691) fixes the issue ? |
@larabr hi, unfortunately this does not work |
@larabr if it can help you |
How are you testing for the issue? Passing a stream with data that triggers an OpenPGP.js error? |
|
I am not clear on the issue you are observing. Are you reading out the |
5.5.0
When we switched from node 18 to node 20 we've encountered this problem, where
decrypt
method resolves the promise, but thedata
does not contain a decrypted stream.The code reads a file using a stream with the
fs.createReadStream
method. If the stream isn't properly closed (either because of an error, or because the stream wasn't fully read), the file remains open. In the original code, we were passing the stream directly toopenpgp.readMessage
, and ifopenpgp.readMessag
e didn't read the stream fully or there was an error in between, the stream was left open.The piece of code:
Solution:
To resolve the issue, we explicitly close the stream using the
stream.destroy()
method after we're done processing it. This ensures that the file descriptor is closed and released appropriately, and it doesn't have to wait for the garbage collector to do it.The text was updated successfully, but these errors were encountered: