Bug 218735

Summary: REGRESSION(r269435): [Debug][GStreamer] Several tests are crashing
Product: WebKit Reporter: Diego Pino <dpino>
Component: New BugsAssignee: Philippe Normand <pnormand>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, bugs-noreply, calvaris, cgarcia, eric.carlson, ews-watchlist, glenn, gustavo, jer.noble, menard, philipj, pnormand, sergio, vjaquez, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Tests crashing logs
none
Patch none

Description Diego Pino 2020-11-09 19:25:20 PST
Created attachment 413655 [details]
Tests crashing logs

Since r269435, several tests are crashing with the following error message:

STDERR: ASSERTION FAILED: !m_impl || Thread::mayBeGCThread() || m_impl->wasConstructedOnMainThread() == isMainThread()
STDERR: DerivedSources/ForwardingHeaders/wtf/WeakPtr.h(94) : T* WTF::WeakPtr< <template-parameter-1-1>, <template-parameter-1-2> >::get() const [with T = WebCore::Frame; Counter = WTF::EmptyCounter]
STDERR: 1   0x7f75920baf05 WTFCrash
STDERR: 2   0x7f75a08343a7 /app/webkit/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0xcc243a7) [0x7f75a08343a7]
STDERR: 3   0x7f75a18a95b8 WTF::WeakPtr<WebCore::Frame, WTF::EmptyCounter>::get() const
STDERR: 4   0x7f75a424204c WebCore::FrameDestructionObserver::frame() const
STDERR: 5   0x7f75a3b9382e WebCore::HTMLMediaElement::mediaPlayerReferrer() const
STDERR: 6   0x7f75a459414c WebCore::MediaPlayer::referrer() const
STDERR: 7   0x7f75a1eca76c /app/webkit/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0xe2ba76c) [0x7f75a1eca76c]
STDERR: 8   0x7f75a1ec93ab /app/webkit/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0xe2b93ab) [0x7f75a1ec93ab]
STDERR: 9   0x7f758bb92ccd /usr/lib/x86_64-linux-gnu/libgstbase-1.0.so.0(+0x43ccd) [0x7f758bb92ccd]
STDERR: 10  0x7f758bb95bd2 /usr/lib/x86_64-linux-gnu/libgstbase-1.0.so.0(+0x46bd2) [0x7f758bb95bd2]
STDERR: 11  0x7f758bac2d67 /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0(+0xc5d67) [0x7f758bac2d67]
STDERR: 12  0x7f758b13a784 /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x80784) [0x7f758b13a784]
STDERR: 13  0x7f758b139e81 /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x7fe81) [0x7f758b139e81]
STDERR: 14  0x7f758c2054d2 /usr/lib/x86_64-linux-gnu/libpthread.so.0(+0x84d2) [0x7f758c2054d2]
STDERR: 15  0x7f7589d492a3 clone
STDERR: LEAK: 1 WebPageProxy

This failed assertion also happened in a few tests for iOS Debug, which was fixed in r269560.

At least, the following tests are crashing:

fast/mediastream/change-tracks-media-stream-being-played.html
fast/table/crash-splitColumn-2.html
http/tests/cache/disk-cache/disk-cache-media-small.html
http/tests/canvas/webgl/origin-clean-conformance.html
http/tests/contentextensions/text-track-blocked.html
http/tests/contentextensions/video-element-resource-type.html
http/tests/inspector/dom/didFireEvent.html
http/tests/media/audio-volume-zero.html
http/tests/media/autoplay-if-audio-is-playing.html
http/tests/media/hls/hls-audio-tracks-has-audio.html
http/tests/media/hls/hls-audio-tracks-locale-selection.html
http/tests/media/hls/hls-audio-tracks.html
http/tests/media/hls/hls-progress.html
http/tests/media/hls/hls-webvtt-tracks.html
http/tests/media/media-document-referer.html
http/tests/media/media-document.html
http/tests/media/media-play-stream-chunked-icy.html
http/tests/media/media-seeking-no-ranges-server.html
http/tests/misc/delete-frame-during-readystatechange-with-gc-after-video-removal.html
http/tests/misc/delete-frame-during-readystatechange.html
http/tests/navigation/page-cache-video.html
http/tests/preload/download_resources.html
http/tests/preload/onload_event.html
http/tests/security/canvas-remote-read-remote-video-allowed-anonymous.html
http/tests/security/canvas-remote-read-remote-video-allowed-with-credentials.html
http/tests/security/canvas-remote-read-remote-video-blocked-no-crossorigin.html
http/tests/security/contentSecurityPolicy/audio-redirect-allowed.html
http/tests/security/contentSecurityPolicy/audio-redirect-allowed2.html
http/tests/security/contentSecurityPolicy/audio-redirect-blocked.html
http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-audio.html
http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-video.html
http/tests/security/mixedContent/insecure-audio-video-in-main-frame.html
http/wpt/fetch/dnt-header-after-redirection.html
http/wpt/resource-timing/rt-initiatorType-media.html

Please find a zip attached with the crash logs for each of these tests.
Comment 1 Diego Pino 2020-11-09 19:27:47 PST
I post here, as an example, the stacktrace of one of the tests crashing:

$ Tools/Script/run-webkit-tests --gtk --debug http/tests/media/media-seeking-no-ranges-server.html

Thread 1 (Thread 0x7f752d9ff700 (LWP 5876)):
#0  WTFCrash() () at ../../Source/WTF/wtf/Assertions.cpp:295
#1  0x00007f75a08343a7 in CRASH_WITH_INFO(...) () at DerivedSources/ForwardingHeaders/wtf/Assertions.h:713
#2  0x00007f75a18a95b8 in WTF::WeakPtr<WebCore::Frame, WTF::EmptyCounter>::get() const (this=0x7f758843ab40) at DerivedSources/ForwardingHeaders/wtf/WeakPtr.h:94
#3  0x00007f75a424204c in WebCore::FrameDestructionObserver::frame() const (this=0x7f758843ab38) at ../../Source/WebCore/page/FrameDestructionObserver.cpp:47
#4  0x00007f75a3b9382e in WebCore::HTMLMediaElement::mediaPlayerReferrer() const (this=0x7f758842c9e0) at ../../Source/WebCore/html/HTMLMediaElement.cpp:6745
#5  0x00007f75a459414c in WebCore::MediaPlayer::referrer() const (this=0x7f752ee3bd80) at ../../Source/WebCore/platform/graphics/MediaPlayer.cpp:1344
#6  0x00007f75a1eca76c in webKitWebSrcMakeRequest(WebKitWebSrc*, WTF::DataMutex<WebKitWebSrcPrivate::StreamingMembers, WTF::OwnerAwareLockAdapter<WTF::Lock> >::LockedWrapper&) (src=0x5621c79a6e50 [WebKitWebSrc|s
#7  0x00007f75a1ec93ab in webKitWebSrcCreate(GstPushSrc*, GstBuffer**) (pushSrc=0x5621c79a6e50 [WebKitWebSrc|source], buffer=0x7f752d9fea98) at ../../Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGSt
#8  0x00007f758bb92ccd in gst_base_src_get_range (src=src@entry=0x5621c79a6e50 [WebKitWebSrc|source], offset=offset@entry=0, length=<optimized out>, length@entry=4096, buf=buf@entry=0x7f752d9feb70) at ../libs/gs
#9  0x00007f758bb95bd2 in gst_base_src_loop (pad=0x5621c7973580 [GstPad|src]) at ../libs/gst/base/gstbasesrc.c:2911
#10 0x00007f758bac2d67 in gst_task_func (task=0x5621c74e05f0 [GstTask|source:src]) at ../gst/gsttask.c:328
#11 0x00007f758b13a784 in g_thread_pool_thread_proxy (data=<optimized out>) at ../glib/gthreadpool.c:354
#12 0x00007f758b139e81 in g_thread_proxy (data=0x5621c786f580) at ../glib/gthread.c:819
#13 0x00007f758c2054d2 in start_thread (arg=<optimized out>) at pthread_create.c:477
#14 0x00007f7589d492a3 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Comment 2 Radar WebKit Bug Importer 2020-11-16 19:26:15 PST
<rdar://problem/71469947>
Comment 3 Alex Christensen 2020-11-17 19:37:32 PST
Looks like non-thread-safe use of MediaPlayer::referrer.  My naive self guesses this may be from webKitWebSrcMakeRequest and the solution may be to store the referrer rather than querying it from the gstreamer thread.
Comment 4 Philippe Normand 2020-11-18 02:14:12 PST
Created attachment 414432 [details]
Patch
Comment 5 EWS 2020-11-18 03:15:43 PST
Committed r269951: <https://trac.webkit.org/changeset/269951>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 414432 [details].