Bug 258876

Summary: [GStreamer][MSE] Crashes on https://www.apple.com/macbook-air-13-and-15-m2/
Product: WebKit Reporter: Kdwk <kdwkleung>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: aboya, bugs-noreply, mcatanzaro, philn
Priority: P2    
Version: WebKit Nightly Build   
Hardware: PC   
OS: Linux   
URL: https://www.apple.com/macbook-air-13-and-15-m2/
Attachments:
Description Flags
flatpak-coredumpctl backtrace
none
Updated flatpak-coredumpctl backtrace
none
All-threads backtrace
none
All-threads backtrace (fixed) none

Description Kdwk 2023-07-05 03:38:20 PDT
**
ERROR:../gst/codecalpha/gstalphacombine.c:160:gst_alpha_combine_unlock_stop: assertion failed: (self->flushing)
Bail out! ERROR:../gst/codecalpha/gstalphacombine.c:160:gst_alpha_combine_unlock_stop: assertion failed: (self->flushing)

(epiphany:2): epiphany-WARNING **: 18:35:48.591: Web process crashed




This is tested on Epiphany Technology Preview/ WebKitGTK 2.41.6, it worked fine in 2.41.5
Comment 1 Michael Catanzaro 2023-07-05 05:04:14 PDT
Since you've been reporting bugs for a while, I'm sure by now you know how to take a backtrace with gdb and a GStreamer debug log, right?

Instructions for the debug log: https://trac.webkit.org/wiki/WebKitGTK/Debugging#Debuggingmultimediastuff
Comment 2 Kdwk 2023-07-05 05:21:35 PDT
Unfortunately, from experience, the backtrace just says n/a whatever I do. I’ll try to get the GStreamer logs…
Comment 3 Michael Catanzaro 2023-07-05 07:37:34 PDT
If you have org.gnome.Sdk.Debug installed and at the same version as your org.gnome.Platform, then it shouldn't say n/a. If it does, that's a runtime bug. Unfortunately I've also found that our debuginfo breaks sometimes, but it shouldn't be *always* broken, so I would try it and see.
Comment 4 Kdwk 2023-07-06 07:03:02 PDT
Created attachment 466945 [details]
flatpak-coredumpctl backtrace

Here is a requested backtrace
Comment 5 Kdwk 2023-07-07 03:45:56 PDT
Created attachment 466969 [details]
Updated flatpak-coredumpctl backtrace

Here is the updated full backtrace
Comment 6 Michael Catanzaro 2023-07-07 06:45:23 PDT
Can you show a backtrace for all threads, please? Use `t a a bt` as suggested on Matrix.

That said, there are no WebKit frames in this backtrace so we might have to move this to GStreamer's issue tracker. Let's see what Phil thinks after you show all threads.
Comment 7 Kdwk 2023-07-07 06:56:35 PDT
Created attachment 466974 [details]
All-threads backtrace

Here's the requested all-threads backtrace
Comment 8 Kdwk 2023-07-07 07:08:07 PDT
Created attachment 466976 [details]
All-threads backtrace (fixed)

Here's the requested all-threads backtrace
Comment 9 Alicia Boya García 2023-07-07 07:20:06 PDT
(In reply to kdwkleung from comment #0)
> **
> ERROR:../gst/codecalpha/gstalphacombine.c:160:gst_alpha_combine_unlock_stop:
> assertion failed: (self->flushing)
> Bail out!
> ERROR:../gst/codecalpha/gstalphacombine.c:160:gst_alpha_combine_unlock_stop:
> assertion failed: (self->flushing)
> 
> (epiphany:2): epiphany-WARNING **: 18:35:48.591: Web process crashed
> 
> 
> 
> 
> This is tested on Epiphany Technology Preview/ WebKitGTK 2.41.6, it worked
> fine in 2.41.5

I heavily suspect this is https://bugs.webkit.org/show_bug.cgi?id=244776 in action. In fact, it's the same outcome: an element downstream of decodebin3 (in this case alphacombine) is receiving a FLUSH_STOP without receiving a FLUSH_START.

I first was made aware of this happening from seeing a similar assertion failing in WebKitVideoSink after it was corrected to use AbortableTaskQueue, and therefore able to handle flushes. I think most people didn't care much about it because it WebKit debug assertions get stripped for release builds.

I've long deduced the race condition is in core GStreamer elements and cannot be easily fixed in WebKit alone. Since a few weeks ago I've finally been able to dedicate more time to investigating this race condition.

I've made good progress on that: I found it's not just one race condition, but several similar races in several elements: decodebin3, playsink and playsinkconvertbin. I've also been able to fix them locally, and I'm currently working towards verifying and upstreaming them.

Unfortunately that also means it's not an easy task and the fixes need not only to be approved in upstream GStreamer but will require new GStreamer versions or GStreamer patches in flatpak.
Comment 10 Alicia Boya García 2023-07-07 07:20:20 PDT

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