3 ms·
"no control of file handles at all" seems like an unfair categorization of the actual issue: file handles backing the JavaScript object are closed when the obje
by iudqnolq 3y ago
"no control of file handles at all" seems like an unfair categorization of the actual issue: file handles backing the JavaScript object are closed when the object is GC'ed, which may not happen immediately after it's done being used.
I'm not sure how this could be fixed. Knowing that the file isn't used anywhere else after you upload it would require a full gc pass in the general case even if it's obvious in your snippet, right?
I'm on my phone or I'd check if chrome on Linux has the same issue. Do you know?
Never closing the file handle on macOS is much more serious, but you don't mention that in the body of your bug report, just on your linked page with a repro demo.
- tripflag 3y agoChrome behaves correctly on Linux, macos and windows, I can confirm that much. Files are immediately closed when they are no longer in use, either by a FileReader() or by an XmlHttpRequest. Firefox /appears/ to immediately be closing files as well, as long as they are only accessed by a FileReader and not by an XmlHttpRequest, however this could just be luck. And I agree my phrasing was suboptimal on that part. I recall that was the first impression I had when encountering the issue and misremembered the details.