Skip to content
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

READ method might leave FileHandle hanging #9

Open
LiviaMedeiros opened this issue Sep 28, 2024 · 0 comments
Open

READ method might leave FileHandle hanging #9

LiviaMedeiros opened this issue Sep 28, 2024 · 0 comments

Comments

@LiviaMedeiros
Copy link
Owner

The tests report: Warning: Closing file descriptor ## on garbage collection
And as consequence: [DEP0137] DeprecationWarning: Closing a FileHandle object on garbage collection is deprecated. Please close FileHandle objects explicitly using FileHandle.prototype.close(). In the future, an error will be thrown if a file descriptor is closed during garbage collection.

The test is somewhat flaky: removing obviously unrelated chunks of the test file makes the issue appear only sometimes, or to not appear at all.

The reason is likely to be READ method and the fd.readableWebStream() in particular. Rewriting it to Node.js Readable fixes the issue. However, I would prefer to keep it using ReadableStream. This looks like either a bug on Node.js side, or just lack of control by design.
It seems that the attempt to close the handle might come after GC.

On a side note, we lack control over the constructor parameters in the helper functions: both stream.Readable.toWeb() and ReadableStream.from() don't allow to set { type: 'bytes' } which is mandatory here. The AbortSignal isn't supported either.

This issue has to be figured out and solved before any rewriting requests with integrity or Range header from chunks to streams.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant