-
Notifications
You must be signed in to change notification settings - Fork 220
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
Callback swallowed leading to Mutex unlock error #221
Comments
Good catch! I should do an audit of the codebase, looking for potential re-applications of callbacks. Is the OverlayFS issue that stat is swallowing an error code that it should return? The stat code is doing a Similarly, |
I don't think the statDone one affected me, I was only using readdir (I haven't created any directories yet)
Possibly EPERM, or an unexpected type of error like ended up getting passed to the callback in readdir (which should be an ApiError) The main thing was the double callback. I'll send a PR for that at least. And the callback being part of a try block at all.
I've started doing this audit now, and there sure are a lot of cases, but I'm on a roll. 😄 |
Ignoring EPERM should be fine; it could be a directory that you didn't have permission to, a chmod caused it to move to writable (because you updated the directory/file), and now you do have access to it. Keep in mind readable is a read-only snapshot of some file system, and writable stores the changes. Data in readable may be out-of-sync with reality. |
Yeah, that makes sense. |
@1j01 What is the status of this issue? I've made a ton of improvements to BFS in recent months so this issue may not be relevant or present anymore. |
Please use zen-fs/core#14 |
Whew! This took some debugging.
I got
Uncaught Error: unlock of a non-locked mutex
, and at first I thought it was thereaddir
failing (and it kind of is), then I noticed that I had typo'd "file
" instead of another variable, and I was trying to hunt down where that variable came from, assuming it was some sort of getter that was causing the error, but it turned out that any error in my callback would cause the mutex error.So I continued debugging, and here's what I found:
readdir
, here (unrelatedly it should probably also check for ENOENT here)XmlHttpRequest.prototype.readdir
, and thenBrowserFS/src/backend/HTTPRequest.ts
Lines 341 to 347 in 73e4eca
The combined result of this is that swallows any errors in my callback, and gives that mutex error instead of any reasonable error.
I'll send a PR for this.
The text was updated successfully, but these errors were encountered: