Bug 213385

Summary: [GStreamer] imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-immediately.https.html is a flaky crash
Product: WebKit Reporter: Diego Pino <dpino>
Component: MediaAssignee: Xabier Rodríguez Calvar <calvaris>
Status: RESOLVED FIXED    
Severity: Normal CC: 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
Patch
pnormand: review+, pnormand: commit-queue-
Patch
calvaris: commit-queue-
Patch none

Description Diego Pino 2020-06-19 09:55:24 PDT
imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-immediately.https.html [ Crash ]

Test was running ok in the last 4000 revisions. Got a crash recently at:

[r263257-r263260]             NOERROR
[r263261-r263262]             UNKNOWN
r263263                       CRASH (Expected: PASS)

Crash-log: https://build.webkit.org/results/GTK%20Linux%2064-bit%20Release%20(Tests)/r263263%20(14157)/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-immediately.https-crash-log.txt

Thread 1 (Thread 0x7fdb7b7fe700 (LWP 95423)):
#0  0x00007fdcd7d284ae in WTFCrash () at /app/webkit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
#1  0x00007fdcdab65365 in  () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#2  0x00007fdcdab6539c in WebCore::CDMProxyClearKey::cencSetCounterVector(WebCore::CDMProxyClearKey::cencDecryptContext const&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#3  0x00007fdcdab656a2 in WebCore::CDMProxyClearKey::cencDecrypt(WebCore::CDMProxyClearKey::cencDecryptContext&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#4  0x00007fdcdab5b6e4 in decrypt(_WebKitMediaCommonEncryptionDecrypt*, _GstBuffer*, _GstBuffer*, _GstBuffer*, unsigned int, _GstBuffer*) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#5  0x00007fdcdab5ccf6 in transformInPlace(_GstBaseTransform*, _GstBuffer*) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#6  0x00007fdcd42e3bf6 in default_generate_output (trans=0x7fdb2801abf0 [WebKitMediaClearKeyDecrypt|webkitmediaclearkeydecrypt10], outbuf=0x7fdb7b7fd3f0) at ../libs/gst/base/gstbasetransform.c:2136
#7  0x00007fdcd42e32f6 in gst_base_transform_chain (pad=<optimized out>, parent=0x7fdb2801abf0 [WebKitMediaClearKeyDecrypt|webkitmediaclearkeydecrypt10], buffer=<optimized out>) at ../libs/gst/base/gstbasetransform.c:2294
#8  0x00007fdcd41d943f in gst_pad_chain_data_unchecked (pad=pad@entry=0x7fdb08118f50 [GstPad|sink], type=type@entry=4112, data=data@entry=0x7fdb840ca5a0) at ../gst/gstpad.c:4327
#9  0x00007fdcd41db5a1 in gst_pad_push_data (pad=pad@entry=0x7fdb10357360 [GstPad|src], type=type@entry=4112, data=data@entry=0x7fdb840ca5a0) at ../gst/gstpad.c:4583
#10 0x00007fdcd41e2493 in gst_pad_push (pad=0x7fdb10357360 [GstPad|src], buffer=0x7fdb840ca5a0 [GstBuffer]) at ../gst/gstpad.c:4702
#11 0x00007fdcd41d943f in gst_pad_chain_data_unchecked (pad=pad@entry=0x7fdb103575b0 [GstPad|sink], type=type@entry=4112, data=data@entry=0x7fdb840ca5a0) at ../gst/gstpad.c:4327
#12 0x00007fdcd41db5a1 in gst_pad_push_data (pad=pad@entry=0x7fdb88376a70 [GstProxyPad|proxypad283], type=type@entry=4112, data=data@entry=0x7fdb840ca5a0) at ../gst/gstpad.c:4583
#13 0x00007fdcd41e2493 in gst_pad_push (pad=pad@entry=0x7fdb88376a70 [GstProxyPad|proxypad283], buffer=buffer@entry=0x7fdb840ca5a0 [GstBuffer]) at ../gst/gstpad.c:4702
#14 0x00007fdcd41c669b in gst_proxy_pad_chain_default (pad=<optimized out>, parent=<optimized out>, buffer=0x7fdb840ca5a0 [GstBuffer]) at ../gst/gstghostpad.c:127
#15 0x00007fdcd41d943f in gst_pad_chain_data_unchecked (pad=pad@entry=0x7fdb8838c600 [GstGhostPad|sink], type=type@entry=4112, data=data@entry=0x7fdb840ca5a0) at ../gst/gstpad.c:4327
#16 0x00007fdcd41db5a1 in gst_pad_push_data (pad=pad@entry=0x7fdb0831c3e0 [GstGhostPad|src_1], type=type@entry=4112, data=data@entry=0x7fdb840ca5a0) at ../gst/gstpad.c:4583
#17 0x00007fdcd41e2493 in gst_pad_push (pad=pad@entry=0x7fdb0831c3e0 [GstGhostPad|src_1], buffer=buffer@entry=0x7fdb840ca5a0 [GstBuffer]) at ../gst/gstpad.c:4702
#18 0x00007fdcd41c669b in gst_proxy_pad_chain_default (pad=<optimized out>, parent=<optimized out>, buffer=0x7fdb840ca5a0 [GstBuffer]) at ../gst/gstghostpad.c:127
#19 0x00007fdcdab5f989 in webkitMediaSrcChain(_GstPad*, _GstObject*, _GstBuffer*) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#20 0x00007fdcd41d943f in gst_pad_chain_data_unchecked (pad=pad@entry=0x7fdb0834ceb0 [GstProxyPad|proxypad282], type=type@entry=4112, data=data@entry=0x7fdb840ca5a0) at ../gst/gstpad.c:4327
#21 0x00007fdcd41db5a1 in gst_pad_push_data (pad=pad@entry=0x7fdb081183c0 [GstPad|src], type=type@entry=4112, data=data@entry=0x7fdb840ca5a0) at ../gst/gstpad.c:4583
#22 0x00007fdcd41e2493 in gst_pad_push (pad=pad@entry=0x7fdb081183c0 [GstPad|src], buffer=0x7fdb840ca5a0 [GstBuffer]) at ../gst/gstpad.c:4702
#23 0x00007fdcd42de885 in gst_base_src_loop (pad=0x7fdb081183c0 [GstPad|src]) at ../libs/gst/base/gstbasesrc.c:2974
#24 0x00007fdcd4210be7 in gst_task_func (task=0x7fdc38013cb0 [GstTask|appsrc51:src]) at ../gst/gsttask.c:328
#25 0x00007fdcd38e3004 in g_thread_pool_thread_proxy (data=<optimized out>) at ../glib/gthreadpool.c:354
#26 0x00007fdcd38e2761 in g_thread_proxy (data=0x7fdb7c001a40) at ../glib/gthread.c:807
#27 0x00007fdcd49355e2 in start_thread (arg=<optimized out>) at pthread_create.c:479
#28 0x00007fdcd25c6473 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Stderr: https://build.webkit.org/results/GTK%20Linux%2064-bit%20Release%20(Tests)/r263263%20(14157)/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-immediately.https-stderr.txt

1   0x7fdcd7d284a9 WTFCrash
2   0x7fdcdab65365 /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37(+0x27d1365) [0x7fdcdab65365]
3   0x7fdcdab6539c WebCore::CDMProxyClearKey::cencSetCounterVector(WebCore::CDMProxyClearKey::cencDecryptContext const&)
4   0x7fdcdab656a2 WebCore::CDMProxyClearKey::cencDecrypt(WebCore::CDMProxyClearKey::cencDecryptContext&)
5   0x7fdcdab5b6e4 /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37(+0x27c76e4) [0x7fdcdab5b6e4]
6   0x7fdcdab5ccf6 /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37(+0x27c8cf6) [0x7fdcdab5ccf6]
7   0x7fdcd42e3bf6 /usr/lib/x86_64-linux-gnu/libgstbase-1.0.so.0(+0x48bf6) [0x7fdcd42e3bf6]
8   0x7fdcd42e32f6 /usr/lib/x86_64-linux-gnu/libgstbase-1.0.so.0(+0x482f6) [0x7fdcd42e32f6]
9   0x7fdcd41d943f /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0(+0x8a43f) [0x7fdcd41d943f]
10  0x7fdcd41db5a1 /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0(+0x8c5a1) [0x7fdcd41db5a1]
11  0x7fdcd41e2493 gst_pad_push
12  0x7fdcd41d943f /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0(+0x8a43f) [0x7fdcd41d943f]
13  0x7fdcd41db5a1 /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0(+0x8c5a1) [0x7fdcd41db5a1]
14  0x7fdcd41e2493 gst_pad_push
15  0x7fdcd41c669b gst_proxy_pad_chain_default
16  0x7fdcd41d943f /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0(+0x8a43f) [0x7fdcd41d943f]
17  0x7fdcd41db5a1 /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0(+0x8c5a1) [0x7fdcd41db5a1]
18  0x7fdcd41e2493 gst_pad_push
19  0x7fdcd41c669b gst_proxy_pad_chain_default
20  0x7fdcdab5f989 /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37(+0x27cb989) [0x7fdcdab5f989]
21  0x7fdcd41d943f /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0(+0x8a43f) [0x7fdcd41d943f]
22  0x7fdcd41db5a1 /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0(+0x8c5a1) [0x7fdcd41db5a1]
23  0x7fdcd41e2493 gst_pad_push
24  0x7fdcd42de885 /usr/lib/x86_64-linux-gnu/libgstbase-1.0.so.0(+0x43885) [0x7fdcd42de885]
25  0x7fdcd4210be7 /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0(+0xc1be7) [0x7fdcd4210be7]
26  0x7fdcd38e3004 /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x7f004) [0x7fdcd38e3004]
27  0x7fdcd38e2761 /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x7e761) [0x7fdcd38e2761]
28  0x7fdcd49355e2 /usr/lib/x86_64-linux-gnu/libpthread.so.0(+0x85e2) [0x7fdcd49355e2]
29  0x7fdcd25c6473 clone
Comment 1 Xabier Rodríguez Calvar 2020-06-27 09:04:01 PDT
Created attachment 402958 [details]
Patch
Comment 2 Philippe Normand 2020-06-29 01:51:09 PDT
Comment on attachment 402958 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402958&action=review

Can you remove the test flakyness from the TestExpectations?

> Source/WebCore/platform/encryptedmedia/CDMProxy.h:225
> +        m_cdmProxy->releaseDecryptionResources();

Are we sure m_cdmProxy is valid here?
Comment 3 Xabier Rodríguez Calvar 2020-06-29 02:38:15 PDT
Comment on attachment 402958 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402958&action=review

Other than this, any other comments to prevent r+?

>> Source/WebCore/platform/encryptedmedia/CDMProxy.h:225
>> +        m_cdmProxy->releaseDecryptionResources();
> 
> Are we sure m_cdmProxy is valid here?

No, you're right, we aren't. It was like that before but this suffered some changes and I forgot to check that. I'll check for null.
Comment 4 Xabier Rodríguez Calvar 2020-06-29 04:18:50 PDT
Created attachment 403049 [details]
Patch
Comment 5 Xabier Rodríguez Calvar 2020-06-29 04:46:36 PDT
Created attachment 403050 [details]
Patch
Comment 6 EWS 2020-06-29 05:06:50 PDT
Committed r263658: <https://trac.webkit.org/changeset/263658>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 403050 [details].
Comment 7 Radar WebKit Bug Importer 2020-06-29 05:07:13 PDT
<rdar://problem/64886014>
Comment 8 Radar WebKit Bug Importer 2020-06-29 05:07:14 PDT
<rdar://problem/64886013>