emscripten-core / emscripten-core/emscripten
OPFS leaves AccessHandles open when my app crashes
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Please include the following in your bug report:
**Version of emscripten/emsdk:**
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.11-git (1e68a1b78e68bec44796a80617f18d29e7d52255)
clang version 21.0.0git (https:/github.com/llvm/llvm-project 2f05451198e2f222ec66cec4892ada0509519290)
Target: wasm32-unknown-emscripten
Thread model: posix
I have spent 2 days trying to create a simple test program the reproduces this, but I could not get it to reproduce.
In our very complicated emscripten application, when it crashes, there are access handles left dangling, such that when we restart, the opens fail with:
```
Failed to execute 'createSyncAccessHandle' on 'FileSystemFileHandle': Access Handles cannot be created if there is another open Access Handle or Writable stream associated with the same file.
```
reloading the web page does not resolve the issue, we have close the chrome browser to recover.
I will be creating a pull request that adds a function
```
void wasmfs_close_opfs_backend(backend_t backend);
```
That I have tested and solves our problem.
Contributor guide
Assessment
This issue has not been assessed yet.