-
Notifications
You must be signed in to change notification settings - Fork 70
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
(node:68141) Warning: Closing file descriptor NNN on garbage collection #46
Comments
I am experiencing the same when parsing a PNG file. The error is 'Error: Unknown file format' followed by 'Warning: Closing file descriptor 35 on garbage collection' |
Is there any update on this? For reference, I am using the code like so on Node v14.15.5 const getFileModifiedTime = (file: string): Date => {
const stats = statSync(file)
return stats.mtime
}
export const getModifiedTime = async (file: string): Promise<Date> => {
try {
const output = await exifr.parse(file)
return output?.DateTimeOriginal ?? getFileModifiedTime(file)
} catch {
return getFileModifiedTime(file)
}
} Which gives warnings like below:
This does happen, as @boxymoron says, when a PNG is parsed. Logging out the error in the |
Hello. Thanks for reaching out. Thanks for providing the info. @adhamu I suppose you call the I'm currently working on the code responsible for opening (and apparently not closing) files in PR #57 . But I can't assure it'll fix the problem. |
Thanks @MikeKovarik. I have run this code against 100s of JPGs at a time and all works fine. It's only when a PNG (like a screenshot) is parsed, I get the warning. Hopefully, your PR fixes it 👍 |
And exifr version are you using? I tried running similar code to yours on a folder of about 170 png screenshots and I couldn't replicate it. Neither on windows nor wsl ubuntu. With the latest node 15 and current exifr 6.1.1. As a matter of fact I remember these warnings occasionally occurring when running tests but it's no longer present there either. |
I'm using I'm struggling to reliably reproduce this myself. |
Ok found out why. I think when an unsupported file is attempted to be parsed, I get the warning. I ran the code against a mix of file types including jpeg, png, gif, html, psd, and logged out the filename in the
|
Aaaaah :D so that's what's happening. |
Nice one. Cheers @MikeKovarik 👍 |
Closed with the latest commit. Thanks @adhamu for pin this down. |
This warning appears when I am trying to read exif data from a large collection of files. It seems like Exifr does not close file handles.
Example code:
The text was updated successfully, but these errors were encountered: