-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix path_watcher #3920
Fix path_watcher #3920
Conversation
1335183
to
044a6fa
Compare
❌ @cirospaciari 2 files with test failures on linux-x64:
|
❌ @cirospaciari 2 files with test failures on linux-x64-baseline:
|
❌ @cirospaciari 3 files with test failures on bun-darwin-aarch64:
|
❌ @cirospaciari 7 files with test failures on bun-darwin-x64-baseline:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not fix it? The finalized
field is set to true in the same scope as the struct is destroyed, which means all cases the struct is used after finalized is a use after free.
bun/src/bun.js/node/path_watcher.zig
Line 816 in 044a6fa
bun.default_allocator.destroy(this); |
It's only used when |
It's not threadsafe though. The finalized boolean would need to be loaded and stored atomically with a @Fence to ensure memory ordering. But even that's not safe because the other thread could be accessing it after deinit |
I used mutex to guarantee access to |
Not all usages are locked by a mutex. If it were, it would hang until after it’s freed and then segfault |
044a6fa
to
f9624bd
Compare
9a8663b
to
f823987
Compare
Thank you |
* fix callback and onError * fix main watcher error return * fixup * rename to be more clear
What does this PR do?
How did you verify your code works?
Existing tests