Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d1ce9f5c801df2fe914a578b6c8b51e7f6aa0220
      
https://github.com/WebKit/WebKit/commit/d1ce9f5c801df2fe914a578b6c8b51e7f6aa0220
  Author: Youenn Fablet <[email protected]>
  Date:   2026-08-13 (Thu, 13 Aug 2026)

  Changed paths:
    M Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/event.cc

  Log Message:
  -----------
  Crash in libwebrtc.dylib:  void 
absl::internal_any_invocable::LocalInvoker<false, void, 
webrtc::MethodCall<webrtc::PeerConnectionInterface, void, 
webrtc::CreateSessionDescriptionObserver*
rdar://181124228

Reviewed by Jean-Yves Avenard and David Kilzer.

We are seeing crashes when calling Event::Wait(kForever) with the following 
principles:
- Event::Wait(kForever) is returning earlier than expected as the main thread 
should be blocked on the executing of the event task.
- Event::Wait(kForever) is doing a 3 seconds wait, then, if not yet settled, a 
forever wait, but only in case the 3 seconds wait is ETIMEDOUT.
- Some crashes show that the process lifetime was less than 3 seconds, which 
shows that the 3 seconds wait is returning earlier than 3 seconds, so not as 
ETIMEDOUT.

To prevent this, we change how wait is done.
Instead of returning once pthread_cond_timedwait returns, we now only return if 
pthread_cond_timedwait returns ETIMEDOUT.
Any other returned value will trigger a new pthread_cond_timedwait call so that 
we wait for the actual timeout (3 seconds or forever for instance) or for the 
task being executed.
We add some logging as this may help further investigations.

Looking at Chromium code, they override the webrtc::Event class with their own 
version.
As a follow-up, we should probably do the same and use a simple BinarySemaphore 
approach (at least for forever calls).

* Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/event.cc:

Originally-landed-as: [email protected] (3c99db1f1186). 
rdar://184745065
Canonical link: https://commits.webkit.org/319098@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to