exifr
exifr copied to clipboard
exifr leaks File Descriptors on error
In https://github.com/MikeKovarik/exifr/issues/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.