Bug 238694

Summary: [Cocoa] semaphore_timedwait() can return KERN_ABORTED
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: New BugsAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, ggaren, kkinnunen, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Myles C. Maxfield 2022-04-01 20:38:18 PDT
[Cocoa] semaphore_timedwait() can return KERN_ABORTED
Comment 1 Myles C. Maxfield 2022-04-01 20:38:58 PDT
Created attachment 456436 [details]
Patch
Comment 2 Geoffrey Garen 2022-04-02 08:43:27 PDT
Comment on attachment 456436 [details]
Patch

Do you know how this happens?

According to documentation, KERN_ABORTED means somebody manually terminated the thread or something like that. That's a bit surprising. Not sure how it would happen. Might be some other bug?
Comment 3 Myles C. Maxfield 2022-04-02 09:04:09 PDT
I only saw it happen while attached to the process in Xcode. I’m not sure exactly what’s happening but it might be due to the debugger.
Comment 4 EWS 2022-04-02 09:37:50 PDT
Committed r292267 (249165@main): <https://commits.webkit.org/249165@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 456436 [details].
Comment 5 Radar WebKit Bug Importer 2022-04-02 09:38:15 PDT
<rdar://problem/91202104>
Comment 6 Chris Dumez 2022-04-02 10:06:55 PDT
(In reply to Geoffrey Garen from comment #2)
> Comment on attachment 456436 [details]
> Patch
> 
> Do you know how this happens?
> 
> According to documentation, KERN_ABORTED means somebody manually terminated
> the thread or something like that. That's a bit surprising. Not sure how it
> would happen. Might be some other bug?

I think this can get called if the remote process (holding the other end of the IPC semaphore) is crashing, no?
Comment 7 Geoffrey Garen 2022-04-02 13:25:45 PDT
> I think this can get called if the remote process (holding the other end of
> the IPC semaphore) is crashing, no?

KERN_TERMINATED means the semaphore was destroyed (which I think is what happens when its creator crashes).

If Xcode interruption triggers KERN_ABORTED on our semaphore, I wonder if execution continues correctly after that?