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

exifr leaks File Descriptors on error #111

Open
aicioara opened this issue May 29, 2023 · 0 comments
Open

exifr leaks File Descriptors on error #111

aicioara opened this issue May 29, 2023 · 0 comments

Comments

@aicioara
Copy link

aicioara commented May 29, 2023

In #58, I presented a few edge cases in which exifr (probably rightly) returns an error in Node.js.

Whether or not it should return an error in those edge cases is debatable. However, it looks like exifr does not free up file descriptors correctly.

# Create a broken file for `exifr`
echo -n 1 > foo.txt
node
> require('exifr').parse('foo.txt')
Promise {
  <pending>,
  [Symbol(async_id_symbol)]: 31,
  [Symbol(trigger_async_id_symbol)]: 5
}
> Uncaught RangeError: Offset is outside the bounds of the DataView
> (node:6314) Warning: Closing file descriptor 24 on garbage collection
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6314) [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.

Edit: This is on Node.js v18.9.0.

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