infinite-mac icon indicating copy to clipboard operation
infinite-mac copied to clipboard

Schrödinger's crash: 8.5 crashes safari but only when web inspector is not open

Open gingerbeardman opened this issue 1 year ago • 14 comments

This is reproducible every time for me.

https://infinitemac.org/1998/Mac%20OS%208.5

  • macOS 12.7.1 (21G920)
  • Safari 17.1 (17616.2.9.11.9, 17616)

Normal (no web inspector)

https://github.com/mihaip/infinite-mac/assets/49612/edf7ca87-d803-4eb3-b71f-cb7c480edfa7

Web inspector open

https://github.com/mihaip/infinite-mac/assets/49612/8c8417d0-59e0-45f5-8282-f3b2c90e7155

gingerbeardman avatar Nov 09 '23 17:11 gingerbeardman

Fascinating. The crash is in JIT-ed code in the worker that runs the emulator. Not sure there's much I can do.

Crashed Thread:        11  WebCore: Worker

Exception Type:        EXC_BAD_ACCESS (SIGKILL)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x000000792cfffffc
Exception Codes:       0x0000000000000002, 0x000000792cfffffc

Termination Reason:    Namespace PAC_EXCEPTION, Code 2 
...
Thread 11 Crashed:: WebCore: Worker
0   ???                           	       0x121aac188 ???
1   ???                           	       0x121ae38f4 ???
2   ???                           	       0x121a65c3c ???
3   ???                           	       0x1218412e8 ???
4   ???                           	       0x121808248 ???
5   ???                           	       0x121808248 ???
6   ???                           	       0x121808248 ???
7   ???                           	       0x121808248 ???
8   ???                           	       0x121808248 ???
9   ???                           	       0x121808248 ???
10  ???                           	       0x121808248 ???
11  ???                           	       0x121808008 ???
12  ???                           	       0x121808728 ???
13  JavaScriptCore                	       0x103f21388 JSC::Interpreter::executeCall(JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 604
14  JavaScriptCore                	       0x1042a91bc JSC::runJSMicrotask(JSC::JSGlobalObject*, WTF::ObjectIdentifierGeneric<JSC::MicrotaskIdentifierType, WTF::ObjectIdentifierThreadSafeAccessTraits>, JSC::JSValue, JSC::JSValue, JSC::JSValue, JSC::JSValue, JSC::JSValue) + 388
15  WebCore                       	       0x1104d3204 WebCore::JSMicrotaskCallback::call() + 200
16  WebCore                       	       0x1108a2a38 WebCore::MicrotaskQueue::performMicrotaskCheckpoint() + 228
17  WebCore                       	       0x11087e8e0 WebCore::EventLoop::run() + 440
18  WebCore                       	       0x11179d080 WebCore::WorkerDedicatedRunLoop::Task::performTask(WebCore::WorkerOrWorkletGlobalScope*) + 224
19  WebCore                       	       0x11179cb90 WebCore::WorkerDedicatedRunLoop::runInMode(WebCore::WorkerOrWorkletGlobalScope*, WebCore::ModePredicate const&) + 816
20  WebCore                       	       0x11179b250 WebCore::WorkerDedicatedRunLoop::run(WebCore::WorkerOrWorkletGlobalScope*) + 132
21  WebCore                       	       0x11179b660 WebCore::WorkerOrWorkletThread::workerOrWorkletThread() + 548
22  JavaScriptCore                	       0x1032472ec WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 244
23  JavaScriptCore                	       0x103056da4 WTF::wtfThreadEntryPoint(void*) + 16
24  libsystem_pthread.dylib       	       0x196177fa8 _pthread_start + 148
25  libsystem_pthread.dylib       	       0x196172da0 thread_start + 8

mihaip avatar Nov 13 '23 05:11 mihaip

No worries, I thought it was the strangest of crashes!

gingerbeardman avatar Nov 13 '23 17:11 gingerbeardman

For all it's worth, it's also happening in Safari Version 17.1 (19616.2.9.11.7) under macOS Sonoma 14.1.1 on an iMac M3 at the time of posting this message. (not that I actually use Safari, but)

that-ben avatar Nov 16 '23 14:11 that-ben

Reported as FB13380365 and at https://bugs.webkit.org/show_bug.cgi?id=264955

gingerbeardman avatar Nov 16 '23 16:11 gingerbeardman

It's kind of weird that it only happens when the inspector is not open. I lol'ed at Schrödinger.

that-ben avatar Nov 16 '23 16:11 that-ben

I'm rarely very interested in bugs, but with this one I would love to know the cause!

Hoping the Schrödinger gets some Apple/WebKit eyes on it.

gingerbeardman avatar Nov 16 '23 16:11 gingerbeardman

I wonder if the inspector just slows down execution enough for the bug not to happen. It almost seems like Safari tries to get ahead too fast for the execution flow? I don't know really, but I'm just guessing. It might not be that, but what can it be if it's not that?

that-ben avatar Nov 16 '23 16:11 that-ben

There has been some activity on the WebKit bug, seems to be an out of memory access (but no clarity as yet on why the web inspector being open prevents it, but maybe permissions/allowances are different when it's open?)

gingerbeardman avatar Nov 17 '23 16:11 gingerbeardman

So basically, what it could mean is that the inspector encapsulates everything in a TRY/CATCH kind of deal where nothing actually crashes, but instead raises exceptions in the console, compared to the inspector not open that would straight just crash? Possible, but weird. Also, why does it only crash with Safari?

that-ben avatar Nov 17 '23 17:11 that-ben

So, "JavaScript compilation changes a lot to aid debugging when Web Inspector is in use."

gingerbeardman avatar Nov 17 '23 20:11 gingerbeardman

This site https://software.inc

Is based on Infinite Mac, and they picked 8.x do it also suffers from this crash. 🙃

gingerbeardman avatar Dec 05 '23 04:12 gingerbeardman

lol I can't even LOAD it under Firefox XD

Screenshot 2023-12-05 at 7 41 20 AM

EDIT: OK now it works. Huh, weird?! Anyway, their site does not implement IM's CTRL<->CMD key binding inversion, so essentially, it's almost unusable on Macs if you use the CMD key a lot like me, plus if you take a look at any of their text files in the "Content" folder, they didn't even bother writing this on Mac either lol :P

Screenshot 2023-12-05 at 7 53 07 AM

that-ben avatar Dec 05 '23 12:12 that-ben

Hey folks, is this still reproducing for anyone on the latest versions of Safari?

justinmichaud avatar Jan 17 '24 22:01 justinmichaud

I can no longer reproduce: Safari 17.2.1 on macOS 14.2.1 Sonoma

gingerbeardman avatar Jan 18 '24 10:01 gingerbeardman