Closed jis260 closed 3 years ago
Sounds like a driver / file system issue. Or maybe a Chrome bug. Hash-wasm is not using the DOM API and you got a DOMException, so I think it's not coming from the library. You can confirming this by using a dummy hash function which, for example, counts the zeros in the input data stream.
Thank you @Daninet for your insights.
Thank you for producing a great library of hash functions.
I have been using hash-wasm to compute various hashes for files during upload. The files are uploaded in chunks and each chunk is passed through a hash-wasm hash function, e.g. SHA-512. Occasionally, and typically after it has processed many file chunks, I see the following error message in the Chrome browser console:
Uncaught (in promise) DOMException: The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.
Tracing back the error, it is associated with calls to:
await hashwasm.create e.g., await hashwasm.create.SHA512()
The await calls were being made in a loop and I have recently changed the code to initiate the hasher outside of the loop and call .init() when required. I'm not sure yet whether this has resolved the issue or whether you can provide other pointers that might help understand the issue. It is a very cryptic DOMException message. The files are being read from a USB device and initially I thought it was associated with the read. The DOMException message is associated with the last line of our upload code. When the log error message is expanded the next line is always associated with where I am using hashwasm.
The only pattern that I observe is that it appears to be more likely to occur after processing many files and many chunks. After it has occurred hard reloading the browser does not resolve the issue and we have found that a complete restart of the computer is required.
Any suggestions would be appreciated please.
Chrome Version 90.0.4430.212 (Official Build) (64-bit) [Ubuntu Linux]