Closed Bug 1685055 Opened 3 years ago Closed 3 years ago

[Wayland] Crashes with src/wayland-client.c:230: wl_proxy_unref: Assertion `proxy->refcount > 0' failed.

Categories

(Core :: Widget: Gtk, defect, P3)

defect

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: stransky, Assigned: stransky)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Crash Data

Attachments

(2 files)

Crash with latest trunk with wr-sw when new popup is opened:

firefox: src/wayland-client.c:230: wl_proxy_unref: Assertion `proxy->refcount > 0' failed.

Renderer thread:
#7 0x00007ffb79eb08a4 in abort () at /lib64/libc.so.6
#8 0x00007ffb79eb0789 in _nl_load_domain.cold () at /lib64/libc.so.6
#9 0x00007ffb79ec0026 in annobin_assert.c_end () at /lib64/libc.so.6
#10 0x00007ffb7832375c in wl_proxy_unref (proxy=<optimized out>) at src/wayland-client.c:230
#11 0x00007ffb78324114 in destroy_queued_closure (closure=0x7ffb0a0a6ba0) at src/wayland-client.c:292
#12 0x00007ffb78324fa4 in dispatch_event (display=display@entry=0x7ffb79c63190, queue=0x7ffb79c9a600, queue=<optimized out>) at src/wayland-client.c:1451
#13 0x00007ffb7832519c in dispatch_queue (queue=0x7ffb79c9a600, display=0x7ffb79c63190) at src/wayland-client.c:1591
#14 wl_display_dispatch_queue_pending (display=0x7ffb79c63190, queue=0x7ffb79c9a600) at src/wayland-client.c:1833
#15 0x00007ffb71478799 in mozilla::widget::nsWaylandDisplay::WaitForSyncEnd() (this=0x7ffb310ce680) at /raid/src/widget/gtk/nsWaylandDisplay.cpp:285
#16 0x00007ffb7147866c in mozilla::widget::nsWaylandDisplay::SyncBegin() (this=0x7ffb310ce680) at /raid/src/widget/gtk/nsWaylandDisplay.cpp:235
#17 0x00007ffb71478aaa in mozilla::widget::WaylandDisplayQueueSyncBegin(RefPtr<mozilla::widget::nsWaylandDisplay>) (aDisplay=[(class mozilla::widget::nsWaylandDisplay *) 0x7ffb310ce680])

Main thread:
#1 0x00007ffb7a3b0763 in pthread_mutex_lock () from /lib64/libpthread.so.0
#2 0x00007ffb783250cf in wl_display_prepare_read_queue (display=0x7ffb79c63190, queue=0x7ffb79c63260) at src/wayland-client.c:1665
#3 0x00007ffb7832512c in wl_display_prepare_read (display=<optimized out>) at src/wayland-client.c:1694
#4 0x00007ffb786f4884 in gdk_event_source_prepare (base=0x7ffb79c60200, timeout=<optimized out>) at wayland/gdkeventsource.c:61
#5 0x00007ffb77e595ea in g_main_context_prepare () from /lib64/libglib-2.0.so.0
#6 0x00007ffb77eab623 in g_main_context_iterate.constprop () from /lib64/libglib-2.0.so.0

Looks like we should avoid simultaneous calls of g_main_context_iteration() at nsAppShell::ProcessNextNativeEvent() on Main thread and wl_display_dispatch_queue_pending() on Render/Compositor thread.

Crash Signature: [@ wl_proxy_unref | destroy_queued_closure]

The crash reason here is the simultaneous calls of wl_display_prepare_read_queue() in main thread and wl_display_dispatch_queue_pending() in compositor/render thread. I inspected the crash reports and they all have this pattern. Also according to Wayland doc wl_display_prepare_read_queue() is not thread safe.

Priority: -- → P3
Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/c46c76db0a48
[Wayland] Dispatch Wayland display queue in main thread only, r=jhorak
https://hg.mozilla.org/integration/autoland/rev/813da913ec72
[Wayland] Post SyncBegin() to main thread only and remove thread specific code as it's unused, r=jhorak

Backed out 2 changesets (bug 1685055) for nsWaylandDisplay related bustage.

Push with failure: https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&fromchange=813da913ec725276f157e0303fd376aa1f0deb16&searchStr=build&selectedTaskRun=fsOCaVxTQDejJwzthiCpEA.0&tochange=057a059129e3e9221baf6711645484dcadf19378

Backout link: https://hg.mozilla.org/integration/autoland/rev/057a059129e3e9221baf6711645484dcadf19378

Failure log: https://treeherder.mozilla.org/logviewer?job_id=326385629&repo=autoland&lineNumber=30063

...
[task 2021-01-11T20:20:29.557Z] 20:20:29     INFO -  In file included from Unified_cpp_widget_gtk2.cpp:110:
[task 2021-01-11T20:20:29.558Z] 20:20:29    ERROR -  /builds/worker/checkouts/gecko/widget/gtk/nsWaylandDisplay.cpp:236:49: error: Refcounted variable 'this' of type 'mozilla::widget::nsWaylandDisplay' cannot be captured by a lambda
[task 2021-01-11T20:20:29.558Z] 20:20:29     INFO -                               [this]() -> void { this->SyncBegin(); }));
[task 2021-01-11T20:20:29.559Z] 20:20:29     INFO -                                                  ^
[task 2021-01-11T20:20:29.559Z] 20:20:29     INFO -  /builds/worker/checkouts/gecko/widget/gtk/nsWaylandDisplay.cpp:236:49: note: Please consider using a smart pointer
[task 2021-01-11T20:20:29.560Z] 20:20:29     INFO -  6 warnings and 1 error generated.
[task 2021-01-11T20:20:29.560Z] 20:20:29     INFO -  /builds/worker/checkouts/gecko/config/rules.mk:674: recipe for target 'Unified_cpp_widget_gtk2.o' failed
[task 2021-01-11T20:20:29.560Z] 20:20:29    ERROR -  make[4]: *** [Unified_cpp_widget_gtk2.o] Error 1

Flags: needinfo?(stransky)

Thanks, will look at it.

Flags: needinfo?(stransky)
Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/7a868134d5f7
[Wayland] Dispatch Wayland display queue in main thread only, r=jhorak
https://hg.mozilla.org/integration/autoland/rev/773f06221b1b
[Wayland] Post SyncBegin() to main thread only and remove thread specific code as it's unused, r=jhorak
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
Regressions: 1687212
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: