NEW 279739
OPFS can deadlock the browser and inspector
https://bugs.webkit.org/show_bug.cgi?id=279739
Summary OPFS can deadlock the browser and inspector
Filip Lundgren
Reported 2024-09-15 13:27:39 PDT
Hi, Our WebAssembly / WebGPU app freezes on the main screen in Safari Technology Preview, while working in Chrome and Firefox (the latter has some other unrelated issues). We've tried to debug but the web inspector seems to bug out and not show any data after the freeze happens. Happy to provide more information where needed.
Attachments
100cpu (216.44 KB, image/png)
2024-09-15 17:19 PDT, Mike Wyrzykowski
no flags
IPC logging prior to hang (15.21 KB, text/plain)
2024-09-16 21:33 PDT, Mike Wyrzykowski
no flags
Filip Lundgren
Comment 1 2024-09-15 13:29:01 PDT
You can see the app here: https://dev.sceneri.com. Please note that this is our development environment and not intended for public usage.
Filip Lundgren
Comment 2 2024-09-15 14:06:00 PDT
Just click "Sign in as Guest" and attempt to scroll in the view that follows to reproduce the bug. Scrolling should suddenly freeze, the app becomes unresponsive and the Safari inspector doesn't seem to indicate what's wrong.
Radar WebKit Bug Importer
Comment 3 2024-09-15 16:15:08 PDT
Mike Wyrzykowski
Comment 4 2024-09-15 17:16:58 PDT
Web process is spinning at 100% cpu
Mike Wyrzykowski
Comment 5 2024-09-15 17:19:19 PDT
Filip Lundgren
Comment 6 2024-09-15 17:26:02 PDT
hmm, I guess the stall somehow breaks the web inspector too - hard to pinpoint if the app is stalling because something goes wrong in the WebGPU implementation or something app-side that only repros in Safari for whatever reason. I'll try to set up a non-release build with symbols and send over email, that might clarify where things are wrong.
Mike Wyrzykowski
Comment 7 2024-09-15 17:36:46 PDT
Maybe WebGPU is doing something wrong, but no WebGPU in the call stacks for any of the threads. Tentatively sending to JSC based on the 100% cpu utilization in JSC Heap Collector Thread I'll check with JavaScriptCore to see if they have any ideas. In any case, seems like a web compat bug if not a WebGPU one since it works on Firefox and Chrome
Mike Wyrzykowski
Comment 8 2024-09-15 21:13:26 PDT
I also notice these assertions opening the page, I'm not sure if they are benign or are actually assertions: blob:https://dev.sceneri.com/58d545ff-4b6d-4419-a147-fe85bb945ccd:1:2629: CONSOLE ERROR C:/gh/_work/sceneri/sceneri/Code/Common/Public\Common/Scripting/VirtualMachine/DynamicFunction/DynamicEvent.h (41): Assert: Failed assertion blob:https://dev.sceneri.com/58d545ff-4b6d-4419-a147-fe85bb945ccd:1:2629: CONSOLE ERROR C:/gh/_work/sceneri/sceneri/Code/Common/Public\Common/Scripting/VirtualMachine/DynamicFunction/DynamicEvent.h (41): Assert: Failed assertion CONSOLE SECURITY ERROR Request header field Content-Type is not allowed by Access-Control-Allow-Headers. blob:https://dev.sceneri.com/58d545ff-4b6d-4419-a147-fe85bb945ccd:1:2629: CONSOLE ERROR C:/gh/_work/sceneri/sceneri/Code/DefaultPlugins/Networking/Analytics/Code/Private/Plugin.cpp (347): Assert: Failed assertion
Filip Lundgren
Comment 9 2024-09-15 21:41:42 PDT
Yup they are benign! They're printing because I disabled analytics for these test builds
Alexey Proskuryakov
Comment 10 2024-09-16 09:01:24 PDT
Just to confirm, this is not a regression from any prior Safari version, correct? In Safari 17.6 on macOS Ventura, I'm getting "WebGPU is not supported" even when it's enabled in Safari preferences.
Filip Lundgren
Comment 11 2024-09-16 10:17:57 PDT
Yeah, it's a WebGPU only application so it's only testable in TP
Mike Wyrzykowski
Comment 12 2024-09-16 21:33:00 PDT
Created attachment 472581 [details] IPC logging prior to hang Attaching the IPC logs from before the hang, doesn't look to be anything incorrect.
Mike Wyrzykowski
Comment 13 2024-09-17 08:17:35 PDT
Very rarely, in MiniBrowser, after adding some logging I am able to scroll fluidly without reproducing the hang. Perhaps there is a race of some sort triggering an infinite loop in the web process and the logging mitigates the chances of reproducing the race? Timing would explain why it doesn't reproduce on Chrome or Firefox.
Mike Wyrzykowski
Comment 14 2024-09-18 08:22:29 PDT
Radar was moved to JavaScriptCore, updating bugzilla component to match
Filip Lundgren
Comment 15 2025-03-12 12:40:05 PDT
Took a while to get back to this, looked into it last night with a local build of WebKit. It seems to be because of this: https://github.com/emscripten-core/emscripten/issues/20650 There are a few potential repro cases in that thread, seems like OFPS is misbehaving in WebKit / Safari causing deadlocks for multiple users.
Filip Lundgren
Comment 16 2025-04-01 02:59:08 PDT
https://67c27c8f6270ca02cf1c1342--sceneri-app-dev.netlify.app/ Here's a permanent link to a repro, simply login with the email below (or your own): - username / email: webkitreprotest@gmail.com - password: testtest The app will freeze very quickly after logging in, because of OPFS. Whenever we create builds that don't use OPFS, it works just fine. Also see the emscripten link above for other projects with the same issue. OPFS in WebKit currently seems extremely unstable. It's blocking the usage on our app because we can't persistently store user info at all.
Note You need to log in before you can comment on or make changes to this bug.