Closed Bug 2059617 Opened 4 months ago Closed 2 months ago

Crash in [@ mozilla::widget::WlLogHandler] (kde) xdg_session_v1#76: error 1: the specified toplevel id is already used

Categories

(Core :: Widget: Gtk, defect)

Firefox 154
Desktop
Linux
defect

Tracking

()

RESOLVED FIXED
158 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox-esr153 --- unaffected
firefox155 --- wontfix
firefox156 --- wontfix
firefox157 --- fixed
firefox158 --- fixed

People

(Reporter: eddiecarswell13, Assigned: stransky)

References

(Regression)

Details

(Keywords: crash, regression, Whiteboard: [tbird crash])

Crash Data

Attachments

(2 files, 4 external files)

Crash report: https://crash-stats.mozilla.org/report/index/25bae48c-6785-4740-8d82-1c4850260731
Crash report: https://crash-stats.mozilla.org/report/index/303d605c-18eb-457c-9052-cb7080260731
Crash report: https://crash-stats.mozilla.org/report/index/ab2e19be-7cfb-4b46-9e34-813bd0260731

MOZ_CRASH Reason:

(kde) xdg_session_v1#76: error 1: the specified toplevel id is already used
 Proxy: WP:E WP:CA WP:CR WP:CPCA WP:CPCF

Top 10 frames:

0  libxul.so  MOZ_CrashSequence(void*, long)  mfbt/Assertions.h:261
0  libxul.so  MOZ_Crash(char const*, int, char const*)  mfbt/Assertions.h:402
0  libxul.so  mozilla::widget::WlLogHandler(char const*, __va_list_tag*)  widget/gtk/nsWaylandDisplay.cpp:1265
1  libwayland-client.so.0  wl_log  /usr/src/debug/wayland-1.25.0-1.fc44.x86_64/src/wayland-util.c:466
2  libwayland-client.so.0  display_handle_error  /usr/src/debug/wayland-1.25.0-1.fc44.x86_64/src/wayland-client.c:1108
3  libffi.so.8  ffi_call_unix64  /usr/src/debug/libffi-3.5.2-2.fc44.x86_64/src/x86/unix64.S:104
4  libffi.so.8  ffi_call_int  /usr/src/debug/libffi-3.5.2-2.fc44.x86_64/src/x86/ffi64.c:676
5  libffi.so.8  ffi_call  /usr/src/debug/libffi-3.5.2-2.fc44.x86_64/src/x86/ffi64.c:713
6  libwayland-client.so.0  wl_closure_invoke  /usr/src/debug/wayland-1.25.0-1.fc44.x86_64/src/connection.c:1243
7  libwayland-client.so.0  dispatch_event  /usr/src/debug/wayland-1.25.0-1.fc44.x86_64/src/wayland-client.c:1731

After a nightly update (not sure which exactly, I hadn't restarted the browser in over a week), one of my profiles crashes without even opening the windows from the previous session. I just get dropped directly into the crash reporter, rendering this profile currently unusable. At the time of browser restart, there were two main windows with a few dozen tabs each and several unclosed poout windows (mostly Twitch widgets).

Is there anything I'd need to do to get more details, or are the above crash reports sufficient?


Operating System: Fedora Linux 44
KDE Plasma Version: 6.7.3
KDE Frameworks Version: 6.28.0
Qt Version: 6.11.1
Kernel Version: 7.0.12-201.fc44.x86_64 (64-bit)
Graphics Platform: Wayland

OS: Unspecified → Linux
Hardware: Unspecified → Desktop

If you can reproduce please run on terminal with WAYLAND_DEBUG=1 MOZ_LOG="WidgetWayland:5" env variables and attach the log here.
Thanks.

Flags: needinfo?(eddiecarswell13)
Severity: -- → S3

First debug log

Second debug log

Flags: needinfo?(eddiecarswell13)

I believe the issue may have had something to do with the presence of those popout windows during session restore.

When I forced the browser to launch with about:sessionrestore instead and only restored the main windows, the browser successfully finished launching. After that, recreating those popout windows and restarting the browser again doesn't reproduce the issue. I wonder if maybe something changed between nightly versions related to how window IDs are created that made that profile unable to be restored as-is.

I did the above test runs with an earlier backup of that problematic profile to reproduce this issue.

The extension I use for decoration-less popout windows: https://addons.mozilla.org/en-US/firefox/addon/popup-window/

Duplicate of this bug: 2065508

Adding comment from Duplicate bug 2065508

Overview

Running on Fedora 44 KDE Wayland, I recently updated Firefox from 153 to 154 and am now experiencing a crash on launch.

I cannot recall whether on first launch I was offered the session-restore page, but now every launch does so. Shortly after clicking the "restore" button (while loading the existing tabs), Firefox crashes, usually within 1-10 seconds.

If run from a terminal, the error displayed is [GFX1-]: (kde) Wayland protocol error: xdg_session_v1#76: error 1: the specified toplevel id is already used. The number after the hash changes with system reboot.

Reproducibility

The crash occurs in safe mode, and I can reproduce it on a new profile by only copying over the contents of the sessionstore-backups folder to the new profile. If there is some way to sanitise this data to pass over for reproducing the issue, I am happy to do so.

I have been unable to find the issue with mozregression, since instructing it to load a profile does not seem to actually bring in the session-restore data, even when using about:sessionrestore as the target page. Again, if there is some way to achieve this I have no problem taking the time to do so.

Relevant Links

Various crash reports for what looks to be the same issue have accumulated in the last couple days:
https://crash-stats.mozilla.org/signature/?product=Firefox&version=154.0&signature=%3Cname%20omitted%3E%20%7C%20mozilla%3A%3Awidget%3A%3AWlLogHandler&date=%3E%3D2026-08-20T00%3A00%3A00.000Z&date=%3C2026-08-21T00%3A00%3A00.000Z&_columns=date&_columns=product&_columns=version&_columns=build_id&_columns=platform&_columns=reason&_columns=address&_columns=install_time&_columns=startup_crash&_sort=-date&page=1#reports

Additional Notes

I have spent some time removing tabs from those to be restored to find minimal examples of open tabs that still suffice to cause the crash.

  • Originally, I had 15 Firefox windows open. I have found there are 4 distinct "pairs" of windows such that the inclusion of any one "pair" in the tabs to be restored is sufficient to cause the crash (and removing one half of each pair is sufficient for the other 11 windows to open safely); it seems like there is some kind of clash where both windows in each pair must try to claim the same ID.
  • Within any given offending window pair, the precise tab(s) to open do not seem to matter - each can be reduced to any single tab from its original complement and still cause a crash.
  • Waiting around 15-20s (and certainly 30s+) between launching firefox and clicking the session restore button has proven sufficient to avoid the crash when already limited to a minimal example (e.g. a single crashing pair of windows). However, this did not seem to work on the full 15 windows - possibly over time the windows have a chance to reallocate into non-clashing IDs?

Adding a minimal reproduction on a clean profile, with a protocol trace that shows the
collision directly, plus a control run. Offered as confirmation of this bug (currently
UNCONFIRMED), not as a new issue.

Build / Platform

  • Firefox 154.0, Build ID 20260818142129 (Fedora RPM firefox-154.0-3.fc44)
  • Fedora Linux 44, KDE Plasma 6.7.4, kwin-6.7.4-2.fc44, Wayland session
  • NVIDIA proprietary driver 610.57.4.0
  • Earliest version exhibiting the problem here: 154.0. Not seen on 153.x.
    (Bug 2065508 likewise reports it appearing on a 153 -> 154 upgrade.)

Steps to Reproduce

Reproducibility: 100%, on a newly created profile.

  1. On a KDE Plasma 6.7 Wayland session, create a new Firefox profile, launch it, and quit.
    The saved session now has one window whose workspaceID is a freshly generated GUID.
  2. Edit <profile>/sessionstore-backups/recovery.jsonlz4 (mozLz4: mozLz40\0 + uint32-LE
    uncompressed size + LZ4 block) so that windows[] holds two entries, and set
    workspaceID on both to the same string, e.g. "2". Write the same content to
    recovery.baklz4.
  3. Set browser.startup.page to 3 (restore previous session).
  4. Launch Firefox with that profile.

Note on step 2: in my run the second window entry was produced by duplicating the first
inside the session file, because I was driving Firefox non-interactively. Opening a second
window with Ctrl+N before step 2 yields the same structure. The value "2" is not special;
any value shared by two windows will do.

In normal use no editing is needed - see Analysis for how this state arises by itself on
upgrade.

Expected Results

The previous session is restored, and each restored window registers a unique toplevel ID.

Actual Results

Firefox aborts about 1.1 s into startup, before any window is presented, and drops into the
crash reporter. The profile is unusable because the same session is retried on every launch.

WAYLAND_DEBUG=1 captures the collision and the compositor's response:

xdg_session_v1#69.restored()
 -> xdg_session_v1#69.restore_toplevel(new id xdg_toplevel_session_v1#106,
                                       xdg_toplevel#105, "2")
 -> xdg_session_v1#69.restore_toplevel(new id xdg_toplevel_session_v1#111,
                                       xdg_toplevel#110, "2")
wl_display#1.error(xdg_session_v1#69, 1, "the specified toplevel id is already used")
ExceptionHandler::GenerateDump ...
Exiting due to channel error.

Crash annotations from that run:

MozCrashReason:        (kde) xdg_session_v1#69: error 1: the specified toplevel id is already used
GraphicsCriticalError: |[0][GFX1-]: (kde) Wayland protocol error: xdg_session_v1#69:
                       error 1: the specified toplevel id is already used (t=0.737097)
UptimeTS:              1.065099934
Version: 154.0   BuildID: 20260818142129   IsWayland: 1   DesktopEnvironment: kde

Process exits on signal 11. A Wayland protocol error is unrecoverable by design, so this is
a hard startup failure.

Control run

Taking the same profile and removing the workspaceID key from both window entries,
changing nothing else, the crash does not occur: Firefox starts normally and emits

 -> xdg_session_v1#68.restore_toplevel(new id xdg_toplevel_session_v1#115,
                                       xdg_toplevel#114, "")

Re-planting the duplicate values makes it crash again. The single field is sufficient to
switch the crash on and off.

New-profile behaviour (per the filing guidelines)

A new profile with default session data does not crash. What is required is session
data containing two windows that share a workspaceID. No extensions, prefs, or other
profile state are involved - browser.startup.page = 3 only ensures the session is
restored at all.

This is consistent with bug 2065508, where copying only the sessionstore-backups folder
into a clean profile reproduced the crash. The above narrows that to one field.

How this arises without editing anything

Observed on two real profiles on this machine, same binary and compositor, differing only in
session data:

Profile A - crashed on 100% of launches
  windows[].workspaceID        == ["2", "2"]            <-- duplicate
  _closedWindows[].workspaceID == ["2","4","5","3","3"]

Profile B - never crashed
  windows[].workspaceID        == ["2", "{a3c19507-5443-44b0-b34b-65ee35b27506}"]

Profile B differed only in that one of its windows had been reopened after the upgrade and
so carried a real GUID, making the pair distinct.

For comparison, a new profile under WAYLAND_DEBUG=1 shows what 154 generates:

xdg_session_manager_v1#37.get_session(new id xdg_session_v1#71, 1, nil)
xdg_session_v1#71.created("cbf85f63-98eb-4d5d-ae2e-f10e2d5250cd")
xdg_session_v1#71.add_toplevel(new id xdg_toplevel_session_v1#79,
                               xdg_toplevel#89,
                               "{9eb79660-5b3a-4dbe-9b15-134d38daaf87}")

Only braced GUIDs. Bare integers cannot have been produced by 154.

Analysis

This section is inference from the observations above; everything before it is observed.

workspaceID appears to be a pre-existing sessionstore field that formerly held the KDE
virtual desktop number
, now reused to carry the xdg-session-management-v1 toplevel ID.
The integers in profile A (2, 3, 4, 5) match virtual desktops 2-5 on that machine.

If so, every session created before 154 carries values that are invalid as toplevel IDs, and
any two windows that shared a virtual desktop now claim the same ID on restore. That would
also account for three things reported in bug 2065508:

  • Why collisions appear in pairs - two windows that shared one virtual desktop. That
    reporter found "4 distinct pairs of windows where both must claim the same ID".
  • Why copying only sessionstore-backups reproduces it - that is where the values live.
  • Why "wait 15-30 s before clicking restore" is unreliable - the stale IDs are static on
    disk and do not change over time, so no reallocation is occurring and the timing effect is
    coincidental. Consistent with it holding for small cases and failing at 15 windows.

Workaround (verified)

Delete the workspaceID key from every entry in windows[] and _closedWindows[] in
sessionstore-backups/{recovery.jsonlz4,recovery.baklz4,previous.jsonlz4}. Firefox then
generates fresh GUIDs on the next launch.

Applied to both affected profiles here. All tabs and window layout were preserved, no profile
deletion was needed, and both have since run normally across repeated restarts.

Suggested direction (suggestion only)

Validate workspaceID when reading session data and treat any value that is not a
well-formed toplevel ID as absent, generating a fresh one. Because the field changed meaning
rather than being newly introduced, pre-154 sessions cannot be assumed to hold valid IDs. A
one-time migration on upgrade would work equally well.

Notes on this bug's metadata

  • The Version field is currently Trunk. The guidelines advise a specific version;
    based on the reports here it looks like 154 Branch.
  • This is a regression. I have not run mozregression to narrow a window, but the
    implementation of session management (bug 1967537) is the obvious candidate range.

Missing data

https://crash-stats.mozilla.org/report/index/15ae0795-401d-48e2-b54a-2821c0260823

The guidelines ask for a Breakpad ID. Crash submission fails on this machine (the telemetry
endpoint is unreachable from this network), so these crashes were never uploaded and I have
no bp- ID to link. The annotations above were read from the local crash event files. I can
submit one and post the ID if that would help.


Disclosure: this analysis was done with the help of an AI coding assistant (Claude). The
reproduction, protocol traces, control run, field values, and workaround were all executed
and verified on the affected machine rather than inferred.

This bug is currently reproducible on Fedora 44 KDE with Firefox 154.0 and can make Firefox completely unusable on startup when restoring an affected session.

In my case, disabling widget.wayland.session-management.enabled immediately restored normal startup with the full existing session, which strongly confirms this issue.

Given that this is a startup-blocking regression affecting existing user profiles after session restore, it would be very helpful to see this bug confirmed and prioritized for a proper fix rather than relying on the preference workaround.

Looks like it comes from session restore which is issued after Firefox start. Let's disable on Fedora it until we fix it.

Flags: needinfo?(stransky)
Flags: needinfo?(stransky)
Keywords: regression
Regressed by: 2044701
Flags: needinfo?(stransky)
Regressions: 2065767
Duplicate of this bug: 2065767
No longer regressions: 2065767

So to summarise, and until the Fedora 44 Firefox package is updated (currently it seems only fixed for F45), there are two ways to get Firefox up and running plus your saved session restored:

A) Start Firefox in X11 instead of Wayland. Run in console:

MOZ_ENABLE_WAYLAND=0 firefox

B) Add the following line at the end of prefs.js in your Firefox profile directory (e.g. $HOME/.mozilla/firefox/xxxxx.default-release or similar):

user_pref("widget.wayland.session-management.enabled", false);

As Germano mentioned in his comment, the latter restores the usual state with no issues.

Also affected, and I can confirm the workspaceID root cause from my own profile.

Environment:

  • Fedora Linux 44 (KDE Plasma Desktop Edition)
  • KDE Plasma 6.7.4 / Wayland (note: slightly newer than the 6.7.3 reported above)
  • Firefox 154.0, BuildID 20260818142129 (distro package firefox-154.0-3.fc44.x86_64)

Symptom: Firefox died ~2.6 s after launch, five times in a row, making it
completely unusable. Notably this did NOT require clicking "Restore Session" --
it happened on plain startup while the previous session was being restored
automatically. Error in each case:

[GFX1-]: (kde) Wayland protocol error: xdg_session_v1#75: error 1: the
specified toplevel id is already used

Confirmation of the workspaceID theory: I decoded my sessionstore backups
(sessionstore-backups/previous.jsonlz4 and recovery.baklz4). Both contain 25
windows, and the workspaceID values are exactly the old KDE virtual-desktop
integers-as-strings:

workspaceID='2' x2 <-- collision
workspaceID='73', '72', '71', '70', '69', '68', '58', '52', '49', '44',
'42', '40', '34', '28', '21', '15', '14', '13', '9', '8', '7', '5', '3'
(one window each)

So exactly one duplicate pair out of 25 windows, which matches the described
failure mode. For contrast, my pre-154 upgrade backup
(upgrade.jsonlz4-20260616073600, written under 153.x, 72 windows) has no
workspaceID key on any window at all.

One additional data point that may be useful: deleting only the
widget.wayland.session-id pref from prefs.js does NOT help. Firefox generated a
fresh GUID on the next start and then crashed again, identically, at the same
~2.6 s mark. The collision comes purely from the per-window workspaceID values,
not from the profile-level session id. Only setting

user_pref("widget.wayland.session-management.enabled", false);

restored normal startup, with the full 25-window session intact.

This supports the suggestion above of validating workspaceID on restore and
regenerating a fresh GUID for values that are not valid toplevel ids, ideally
as a one-time migration on upgrade -- otherwise every profile upgrading from
153 with two windows on the same virtual desktop hits this.

Distro packaging note that may explain why every reporter here is on Fedora
KDE: upstream disabled this on release in bug 2054017, but the Fedora package
re-enables it. In firefox-154.0-3.fc44, the file
/usr/lib64/firefox/browser/defaults/preferences/firefox-redhat-default-prefs.js
contains:

pref("widget.wayland.session-management.enabled", true);

The package changelog shows 154.0-1 "Enabled session restore (KDE only)" and
then 154.0-2 "Disabled session restore on Fedora 45+ dues to crashes." -- so the
mitigation was applied to F45+ only, while F44 still ships it enabled. I am
filing this separately against the Fedora package.

Crash report IDs:
0decf40a-d07b-2766-2da0-2038643ce628 25.08.26, 19:32
1a5b3404-776a-7526-30e3-dd47f6eac06c 25.08.26, 19:30
793eafb0-8e57-93ff-6d86-642ef590a273 25.08.26, 19:29
74305e6b-b4b6-a817-f57d-c43b03659f45 25.08.26, 19:29
70435429-c0aa-a198-2883-780a04ef9e18 25.08.26, 19:29
6a551524-d66f-bc3a-125a-ab783973fb0c 25.08.26, 19:29

Okay, we can fix that by removing session ID which are not UUID on Wayland.

Assignee: nobody → stransky
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Integer workspace ID causes conflicts on session restore so use uuid everywhere and ignore integer ones to avoid protocol errors.

Flags: needinfo?(stransky)

Set release status flags based on info from the regressing bug 2044701

Crash Signature: [@ mozilla::widget::WlLogHandler]
Keywords: crash
Whiteboard: [tbird crash]
Version: Trunk → Firefox 154

The patch landed in nightly and beta is affected.
:stransky, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(stransky)
Flags: needinfo?(stransky)
Attachment #9641968 - Flags: approval-mozilla-beta?

firefox-beta Uplift Approval Request

  • User impact if declined/Reason for urgency: Crashes on KDE when old session is stored on profile.
  • Code covered by automated testing?: no
  • Fix verified in Nightly?: no
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: We changed window ID from integers to UUID so ignore old integer ones to avoid duplicity/crashes in Wayland protocol.
  • String changes made/needed?: none
  • Is Android affected?: yes
Attachment #9641969 - Flags: approval-mozilla-beta?

Integer workspace ID causes conflicts on session restore so use uuid everywhere and ignore integer ones to avoid protocol errors.

Original Revision: https://phabricator.services.mozilla.com/D324871

Martin, looking at the crashes on nightly, it seems that we are still crashing in builds that have the fix.

Flags: needinfo?(stransky)

(In reply to Pascal Chevrel (relman team) -> :pascalc from comment #25)

Martin, looking at the crashes on nightly, it seems that we are still crashing in builds that have the fix.
I see

(gnome) xdg_session_v1#69: error 1: Name of toplevel is already in use
 Proxy: WP:E WP:CA WP:CPCA 

and that's https://bugzilla.mozilla.org/show_bug.cgi?id=2064100 / https://gitlab.gnome.org/GNOME/mutter/-/work_items/4992

I wonder if https://phabricator.services.mozilla.com/D324876 does not hold here or so. Maybe we check the env wrongly? But in that case we'd missing the (gnome) tag in the name.

Flags: needinfo?(stransky)

Will be great to have sorted output of 'MOZ_CRASH Reason (Sanitized)' from the crash reports but I can't see that.

(In reply to Martin Stránský [:stransky] (ni? me) from comment #26)

(In reply to Pascal Chevrel (relman team) -> :pascalc from comment #25)

Martin, looking at the crashes on nightly, it seems that we are still crashing in builds that have the fix.
I see

(gnome) xdg_session_v1#69: error 1: Name of toplevel is already in use
 Proxy: WP:E WP:CA WP:CPCA 

and that's https://bugzilla.mozilla.org/show_bug.cgi?id=2064100 / https://gitlab.gnome.org/GNOME/mutter/-/work_items/4992

I wonder if https://phabricator.services.mozilla.com/D324876 does not hold here or so. Maybe we check the env wrongly? But in that case we'd missing the (gnome) tag in the name.

I am guessing we don't need to uplift to beta as this would not solve the crashes, correct? Thanks

Flags: needinfo?(stransky)

(In reply to Pascal Chevrel (relman team) -> :pascalc from comment #28)

(In reply to Martin Stránský [:stransky] (ni? me) from comment #26)

(In reply to Pascal Chevrel (relman team) -> :pascalc from comment #25)

Martin, looking at the crashes on nightly, it seems that we are still crashing in builds that have the fix.
I see

(gnome) xdg_session_v1#69: error 1: Name of toplevel is already in use
 Proxy: WP:E WP:CA WP:CPCA 

and that's https://bugzilla.mozilla.org/show_bug.cgi?id=2064100 / https://gitlab.gnome.org/GNOME/mutter/-/work_items/4992

I wonder if https://phabricator.services.mozilla.com/D324876 does not hold here or so. Maybe we check the env wrongly? But in that case we'd missing the (gnome) tag in the name.

I am guessing we don't need to uplift to beta as this would not solve the crashes, correct? Thanks

Would be good to uplift to along with Bug 2070815 - that will fix the crashes on KDE and disable it on Gnome so we should be covered for Beta/Dev edition.

Flags: needinfo?(stransky)

:stransky,
this bug was marked RESOLVED FIXED on , but crashes are still being reported against this signature on Nightly. Since the day after the fix landed (), crashes have been recorded on Nightly across the 0 signatures on this bug.
Could you take a look at the recent crash reports to determine whether the fix is incomplete, whether the signature is shared with a different underlying crash, or whether a follow-up is needed?
For more information, please visit BugBot documentation.

Flags: needinfo?(stransky)
Flags: needinfo?(stransky)
Attachment #9641969 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9641968 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Regressions: 2090009
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: