wslg icon indicating copy to clipboard operation
wslg copied to clipboard

GUI locked up if application is running and Windows goes to sleep

Open pappde opened this issue 1 year ago • 24 comments

Windows Version

Microsoft Windows [Version 10.0.19045.4529]

WSL Version

2.2.4.0

Are you using WSL 1 or WSL 2?

  • [X] WSL 2
  • [ ] WSL 1

Kernel Version

5.15.153.1-microsoft-standard-WSL2

Distro Version

Ubuntu 22.04

Other Software

SmartGit 23.1.3

Repro Steps

  1. install SmartGit
  2. run SmartGit (using the start menu)
  3. observe UI responds correctly
  4. put Windows to sleep
  5. wake up Windows
  6. observe you can activate the SmartGit window, but cannot interact with it in any way. Appears frozen
  7. try to close through the taskbar, or by clicking "X"
  8. observe that doesn't work

Expected Behavior

Application should continue working and not be frozen.

Actual Behavior

Application is frozen. You can activate the window via the task bar, but it will not respond to any clicks. You cannot kill it from the task manager. You can kill it with "kill -9"

Diagnostic Logs

No response

pappde avatar Jul 03 '24 17:07 pappde

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

github-actions[bot] avatar Jul 03 '24 17:07 github-actions[bot]

NOTES:

  1. I reported this to SmartGit and they stated it may be a WSL bug, since they reproduced it with Windows 11 and Ubuntu 22.04 running another application "gedit".
  2. It is 100% repro
  3. I see the following spam error repeated in the application output: (SmartGit:488357): Gtk-CRITICAL **: 12:21:03.935: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar

pappde avatar Jul 03 '24 17:07 pappde

Diagnostic information
.wslconfig found
Detected appx version: 2.2.4.0

github-actions[bot] avatar Jul 03 '24 17:07 github-actions[bot]

I observe the same issue. This happens when I run emacs built with Wayland. The app is "running" but it doesn't process user input, neither mouse nor keyboard presses. For example, I can resize it with the Windows+Arrow keys, but typing or clicking anywhere in the window is ignored. If I right-click on the taskbar button and click "Close window," the "Are you sure you want to exit emacs?" dialog will pop up within emacs, but I cannot interact with that dialog in any way.

Subsequently-created WSLG windows are perfectly functional though.

zc1036 avatar Jul 10 '24 00:07 zc1036

This happens to me too, with chrome in Wayland mode. Works fine until I sleep / hibernate then when it wakes up the window is frozen. I can kill with "pkill chrome" from a WSL command line and then open it again.

As others have said, the application is not frozen, just the Window, as I can see things happening such as tabs opening from outside. Note that using "X11" mode appears to not freeze; I have eclipse in this mode and can use Chrome in that mode too without issue (but Chrome is ugly in that mode ;).

rowleya avatar Sep 18 '24 07:09 rowleya

Same issue for me, Emacs in wayland. Very annoying, thinking my next laptop might be a mac because of this.

didibus avatar Nov 03 '24 23:11 didibus

I'm also facing the same issue with Emacs.

luigidcsoares avatar Nov 12 '24 05:11 luigidcsoares

I believe this issue might be the longstanding GTK issues in Emacs. I switched to lucid and haven't experienced this issue since. Which was quite frequent, prominent and disrupting to my daily workflow.

terlar avatar Nov 12 '24 06:11 terlar

same issue when running pure GTK emacs on Wayland/Gentoo.

kimim avatar Jan 08 '25 05:01 kimim

same thing running Sublime Text 4 on X server.

anton90ct avatar Mar 08 '25 00:03 anton90ct

Same issue running Firefox (snap) and Kitty but only on Wayland. When I set Kitty to run on x11 the window is still responsive after waking up from sleep.

angeljreyes avatar Mar 24 '25 12:03 angeljreyes

Can also reproduce on xfce4-terminal and chromium-browser.

In fact, I don't know of a single wslg program where I cannot reproduce it, but I don't use many wslg's anyway.

divinity76 avatar Jul 27 '25 13:07 divinity76

I'm also experiencing this on all GTK applications (that I have tried) running on wayland.

I attached a partial weston.log. At 22:14:10.309 I opened dconf-editor then I hibernated the system and after waking it up and logging in the application was unresponsive and I had to kill it from terminal.

weston-partial.log

grobx avatar Jul 29 '25 20:07 grobx

I can reproduce the same issue with Emacs with pure GTK on Wayland (emacs-pgtk package on Ubuntu 22.04.3) on WSL2 (kernel 6.6.87.2-microsoft-standard-WSL2).

  1. I started WSL logs collection at 19:23.
  2. I opened Emacs (emacs) and observed that the GUI window works normally
  3. I put Windows into sleep mode
  4. I resumed Windows
  5. The Emacs GUI window was still there, but it wasn't reacting to anything (including clicking on the 'X' button to close)
    • Note: ps axu was reporting the process in Sl+ status. strace was showing that there was still activity in the process (an event loop?)
  6. I stopped the WSL logs collection

WSL and Weston logs attached.

WslLogs-2025-08-06_19-23-55.zip

weston-logs-2025-08-06_19_11_00.txt

adamjasinski avatar Aug 07 '25 10:08 adamjasinski

I have this same issue with Sublime Merge. I solved it by switching to X11.

When using Wayland, it will consistently freeze if I sleep then wake the computer. When using X11, it keeps working forever! I added:

export GDK_BACKEND=x11

to my .zshrc file and it solved the issue for me!

Jaxkr avatar Aug 24 '25 19:08 Jaxkr

This is still happening, even with the latest updates. @hideyukn88 Can you take a look at this or bring it to the attention of someone at Microsoft, it's been broken for over a year.

It does seem exclusive to GTK apps on Wayland. This bug can be consistently reproduced by starting gedit, sleeping the computer, then waking it up. After this, the app will be frozen.

Jaxkr avatar Oct 01 '25 21:10 Jaxkr

I have this same issue with Sublime Merge. I solved it by switching to X11.

When using Wayland, it will consistently freeze if I sleep then wake the computer. When using X11, it keeps working forever! I added:

export GDK_BACKEND=x11

to my .zshrc file and it solved the issue for me!

That also works for me with ~/.bashrc and xfce4-terminal 👍

divinity76 avatar Oct 06 '25 05:10 divinity76

I have this same issue with Sublime Merge. I solved it by switching to X11. When using Wayland, it will consistently freeze if I sleep then wake the computer. When using X11, it keeps working forever! I added:

export GDK_BACKEND=x11

to my .zshrc file and it solved the issue for me!

That also works for me with ~/.bashrc and xfce4-terminal 👍

Yeah, sadly this makes the window chrome very ugly.

Jaxkr avatar Oct 06 '25 22:10 Jaxkr

I've also had this issue forever, and I do not know very much about wsl and linux, so I hope a solution can be found for this. I am tired of having to regularly have to restart my wsl GUI applications.

nerffan1 avatar Oct 16 '25 20:10 nerffan1

According to https://github.com/microsoft/wslg/issues/1098#issuecomment-3400318086 this might be fixed in the latest pre-release, at least if those two issues are the same (which they sound like). Has anyone tried?

oxc avatar Oct 17 '25 07:10 oxc

According to #1098 (comment) this might be fixed in the latest pre-release, at least if those two issues are the same (which they sound like). Has anyone tried?

https://github.com/microsoft/weston-mirror/pull/158 looks like it fixes the root cause.

Jaxkr avatar Oct 20 '25 03:10 Jaxkr

I can confirm this is fixed in the WSL prerelease! You can install with wsl --update --pre-release.

Apps now remain responsive after sleep/wake! 🥳 Thank you @hideyukn88!!!!

However, I have encountered some regressions I've never seen before:

  • wslg apps are now missing their icon in the taskbar and now just have a tux
  • Sometimes the cursor disappears in wslg apps

Jaxkr avatar Oct 20 '25 04:10 Jaxkr

@Jaxkr Thanks! I've tried to runwsl --update --pre-release. It works. The same issue as you observed, the app icon turns to a tux now.

kimim avatar Nov 14 '25 00:11 kimim