Bug 213928

Summary: WebKit.WebContent crashes intermittently when rendering audio tracks on Safari
Product: WebKit Reporter: hhafeez
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: ap, cdumez, eric.carlson, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari 13   
Hardware: Mac   
OS: macOS 10.15   
Attachments:
Description Flags
WebContent logs at time 12:12 (the moment of crash)
none
Complete WebContent Crash Report none

Description hhafeez 2020-07-03 10:25:07 PDT
Created attachment 403464 [details]
WebContent logs at time 12:12 (the moment of crash)

Occurs on Safari on MacOS and iOS. Not sure if this will help, but usually occurs when the app tries to setRemoteDescription (which adds/removes tracks from containers)

Page simply reloads with a message at the top saying "This web page was reloaded because a problem occurred."

The following thread crashes:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.WebCore             	0x00007fff455db1de WTF::Detail::CallableWrapper<WebCore::MediaStreamTrackPrivate::sourceStarted()::$_18, void, WebCore::MediaStreamTrackPrivate::Observer&>::call(WebCore::MediaStreamTrackPrivate::Observer&) + 14
1   com.apple.WebCore             	0x00007fff455d7c9c WebCore::MediaStreamTrackPrivate::forEachObserver(WTF::Function<void (WebCore::MediaStreamTrackPrivate::Observer&)> const&) const + 748
2   com.apple.WebCore             	0x00007fff455d80c9 WebCore::MediaStreamTrackPrivate::sourceStarted() + 57
3   com.apple.WebCore             	0x00007fff455dd59c WebCore::RealtimeMediaSource::forEachObserver(WTF::Function<void (WebCore::RealtimeMediaSource::Observer&)> const&) const + 748
4   com.apple.WebCore             	0x00007fff455dd18d WebCore::RealtimeMediaSource::start() + 173
5   com.apple.WebCore             	0x00007fff455dd0ca WebCore::RealtimeMediaSource::setMuted(bool) + 394
6   com.apple.WebCore             	0x00007fff4498c669 WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded() + 569
7   com.apple.JavaScriptCore      	0x00007fff389a7aae WTF::dispatchFunctionsFromMainThread() + 462
8   com.apple.Foundation          	0x00007fff377d10dd __NSThreadPerformPerform + 204
9   com.apple.CoreFoundation      	0x00007fff350ffde2 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
10  com.apple.CoreFoundation      	0x00007fff350ffd81 __CFRunLoopDoSource0 + 103
11  com.apple.CoreFoundation      	0x00007fff350ffb9b __CFRunLoopDoSources0 + 209
12  com.apple.CoreFoundation      	0x00007fff350fe8ca __CFRunLoopRun + 927
13  com.apple.CoreFoundation      	0x00007fff350fdece CFRunLoopRunSpecific + 462
14  com.apple.Foundation          	0x00007fff377961c8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
15  com.apple.Foundation          	0x00007fff37848c6f -[NSRunLoop(NSRunLoop) run] + 76
16  libxpc.dylib                  	0x00007fff6f34851a _xpc_objc_main.cold.4 + 49
17  libxpc.dylib                  	0x00007fff6f348460 _xpc_objc_main + 559
18  libxpc.dylib                  	0x00007fff6f347f93 xpc_main + 377
19  com.apple.WebKit              	0x00007fff46183f3a WebKit::XPCServiceMain(int, char const**) + 539
20  libdyld.dylib                 	0x00007fff6f0facc9 start + 1

I've attached the WebContent logs during the minute the crash happened.
Comment 1 Alexey Proskuryakov 2020-07-03 17:15:05 PDT
Could you please attach a complete crash log, too? That way I can find other related issues.
Comment 2 hhafeez 2020-07-06 07:47:25 PDT
Created attachment 403594 [details]
Complete WebContent Crash Report

Hi Alexey, I've added the complete Crash Report as an attachment.
Comment 3 Alexey Proskuryakov 2020-07-06 10:32:57 PDT
Thank you. This looks like a somewhat infrequent crash, so it is very interesting that you can hit it semi-reproducibly. If there is some way in which you could share a repro case, that would be helpful.
Comment 4 Radar WebKit Bug Importer 2020-07-06 10:33:08 PDT
<rdar://problem/65137851>
Comment 5 youenn fablet 2020-07-20 07:27:16 PDT
Thanks for the report.
Are you able to repro it in latest Safari Tech Preview?
We made significant changes, and this might be fixed after https://bugs.webkit.org/show_bug.cgi?id=210492
Comment 6 hhafeez 2020-07-21 09:24:10 PDT
Hi Alexey and youenn,

It's a bit difficult to provide a reproducible test case at the moment, I apologize.

However, the latest Safari Tech Preview does seem to fix this issue for me.

A few questions:

1. Do you have a timeline on when the fix(es) will be available in the mainline Safari?
2. Could you provide some insight on the bug(s) fixed and how they might've been encountered? In my case it looked to be an issue related to rendering media tracks into containers.
Comment 7 youenn fablet 2020-07-27 01:45:43 PDT
Closing as duplicate to 210492.

(In reply to hhafeez from comment #6)
> Hi Alexey and youenn,
> 
> It's a bit difficult to provide a reproducible test case at the moment, I
> apologize.
> 
> However, the latest Safari Tech Preview does seem to fix this issue for me.
> 
> A few questions:
> 
> 1. Do you have a timeline on when the fix(es) will be available in the
> mainline Safari?

Partial fixes are available in latest iOS/MacOS versions.
https://bugs.webkit.org/show_bug.cgi?id=210492 landed in latest iOS/MacOS betas.

> 2. Could you provide some insight on the bug(s) fixed and how they might've
> been encountered? In my case it looked to be an issue related to rendering
> media tracks into containers.

It depends on your page.
A potential workaround is to asynchronously do work in case of track muted event (like a setTimeout).

*** This bug has been marked as a duplicate of bug 210492 ***