System hangs for a few seconds

Forum rules
Before you post please read how to get help
Post Reply
atirage
Level 1
Level 1
Posts: 15
Joined: Sun Dec 08, 2019 9:35 am

System hangs for a few seconds

Post by atirage »

Hello!

I'm running a Mint 20.1 Mate edition and I recently noticed that after my laptops comes out of sleep, I'm getting sporadic system hangs.
First I noticed that my mouse cursor just stops for a few seconds, but then I realized that the whole system hangs.

Looking at the system monitor I can see that I'm getting spikes in the CPU load and these spikes are correlated with the system hangs:
peaks.png
When I look at top output, I can see that the process causing these spikes is Xorg, goes up to 60-70%.
A restart solves the issue, but it's kinda annoying to restart the laptop after each sleep. :)

Any idea how to debug this further?
In case it helps here are the details of my setup:

Code: Select all

inxi -Fxxxz
System:    Kernel: 5.4.0-72-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: MATE 1.24.0 
           info: mate-panel, plank wm: marco 1.24.0 dm: LightDM 1.30.0 Distro: Linux Mint 20.1 Ulyssa 
           base: Ubuntu 20.04 focal 
Machine:   Type: Laptop System: LENOVO product: 81LL v: IdeaPad L340-17IRH Gaming serial: <filter> Chassis: type: 10 
           v: IdeaPad L340-17IRH Gaming serial: <filter> 
           Mobo: LENOVO model: LNVNB161216 v: SDK0J40700 WIN serial: <filter> UEFI: LENOVO v: BGCN33WW 
           date: 11/24/2020 
Battery:   ID-1: BAT0 charge: 6.9 Wh condition: 41.5/45.0 Wh (92%) volts: 11.5/11.5 model: Celxpert L18C3PF1 
           type: Li-poly serial: <filter> status: Charging cycles: 71 
CPU:       Topology: Quad Core model: Intel Core i5-9300H bits: 64 type: MT MCP arch: Kaby Lake rev: A 
           L2 cache: 8192 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 38400 
           Speed: 1252 MHz min/max: 800/2400 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 
           8: 800 
Graphics:  Device-1: Intel UHD Graphics 630 vendor: Lenovo driver: i915 v: kernel bus ID: 00:02.0 chip ID: 8086:3e9b 
           Device-2: NVIDIA TU117M [GeForce GTX 1650 Mobile / Max-Q] vendor: Lenovo driver: nvidia v: 460.73.01 
           bus ID: 01:00.0 chip ID: 10de:1f91 
           Display: x11 server: X.Org 1.20.9 driver: modesetting,nvidia unloaded: fbdev,nouveau,vesa 
           compositor: compton v: 0.1~beta2+20150922 resolution: 1920x1080~60Hz 
           OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 20.2.6 direct render: Yes 
Audio:     Device-1: Intel Cannon Lake PCH cAVS vendor: Lenovo driver: snd_hda_intel v: kernel bus ID: 00:1f.3 
           chip ID: 8086:a348 
           Device-2: NVIDIA vendor: Lenovo driver: snd_hda_intel v: kernel bus ID: 01:00.1 chip ID: 10de:10fa 
           Sound Server: ALSA v: k5.4.0-72-generic 
Network:   Device-1: Realtek RTL8821CE 802.11ac PCIe Wireless Network Adapter vendor: Lenovo driver: rtl8821ce 
           v: v5.5.2.1_35598.20191029 port: 4000 bus ID: 07:00.0 chip ID: 10ec:c821 
           IF: wlp7s0 state: up mac: <filter> 
           Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Lenovo driver: r8169 v: kernel 
           port: 3000 bus ID: 08:00.0 chip ID: 10ec:8168 
           IF: enp8s0 state: down mac: <filter> 
Drives:    Local Storage: total: 953.87 GiB used: 46.54 GiB (4.9%) 
           ID-1: /dev/nvme0n1 vendor: Samsung model: MZVLB1T0HALR-000L2 size: 953.87 GiB speed: 31.6 Gb/s lanes: 4 
           serial: <filter> rev: 5L1QEXA7 scheme: GPT 
Partition: ID-1: / size: 166.02 GiB used: 44.35 GiB (26.7%) fs: ext4 dev: /dev/nvme0n1p5 
           ID-2: swap-1 size: 14.93 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/nvme0n1p7 
Sensors:   System Temperatures: cpu: 51.0 C mobo: N/A 
           Fan Speeds (RPM): N/A 
Info:      Processes: 320 Uptime: 6d 4h 54m Memory: 15.52 GiB used: 4.98 GiB (32.1%) Init: systemd v: 245 
           runlevel: 5 Compilers: gcc: 9.3.0 alt: 9 Shell: bash v: 5.0.17 running in: mate-terminal inxi: 3.0.38
Thanks in advance!
Last edited by atirage on Sat May 22, 2021 7:53 am, edited 2 times in total.
User avatar
SMG
Level 15
Level 15
Posts: 5584
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: Systems hangs for a few seconds

Post by SMG »

atirage wrote:
Tue May 04, 2021 5:35 pm
Looking at the system monitor I can see that I'm getting spikes in the CPU load and these spikes are correlated with the system hangs:
I helped someone with a Lenovo running Cinnamon whose computer had micro freezes. After checking a video that person posted I noticed a pattern similar to what you describe. In that case only one cpu was spiking, but it went up to around 90%. The issue went away when that person upgraded to the 5.8 kernel.

Open Update Manager. Select View > Linux Kernels and click Continue. Make sure 5.8 is selected on the left panel and then click the top-most option on the right panel. An "Install" button will appear. Install the kernel and then reboot for it to become active.
A woman typing on a laptop with LM20.1 Cinnamon.
atirage
Level 1
Level 1
Posts: 15
Joined: Sun Dec 08, 2019 9:35 am

Re: Systems hangs for a few seconds

Post by atirage »

Thanks for the tip, SMG!
I'll try that and get back to you.
atirage
Level 1
Level 1
Posts: 15
Joined: Sun Dec 08, 2019 9:35 am

Re: Systems hangs for a few seconds

Post by atirage »

Looks good till now with:

Code: Select all

5.8.0-53-generic
Thanks again!
User avatar
SMG
Level 15
Level 15
Posts: 5584
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: Systems hangs for a few seconds

Post by SMG »

If that seems to have cleared the issue, please edit your first post in this thread by clicking the pencil icon and adding [SOLVED] to the beginning of the title. That will let others with a similar issue know there is a possible solution for them in this thread.
A woman typing on a laptop with LM20.1 Cinnamon.
atirage
Level 1
Level 1
Posts: 15
Joined: Sun Dec 08, 2019 9:35 am

Re: System hangs for a few seconds

Post by atirage »

Just as I marked it SOLVED, the issue came back: same sporadic spikes and system freeze. :(
What I can safely say now is, that it only happens on battery power and just plugging back the charger doesn't fix it.
Some additional hints:
  • it doesn't happen if I'm not moving the cursor(mouse or touchpad)
  • when it occurs, I'm getting these events in the Xorg log:

    Code: Select all

    [ 25965.715] (II) event6  - Microsoft Microsoft® Nano Transceiver v2.0 Mouse: SYN_DROPPED event - some input events have been lost.
    [ 26111.065] (II) event11 - Elan Touchpad: SYN_DROPPED event - some input events have been lost.
    
User avatar
SMG
Level 15
Level 15
Posts: 5584
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: System hangs for a few seconds

Post by SMG »

atirage wrote:
Sat May 22, 2021 9:26 am
What I can safely say now is, that it only happens on battery power and just plugging back the charger doesn't fix it.
Are you needing to use the power button to restart the system? If so, run the following in a terminal after you restart the computer:
journalctl -rb -1 | nc termbin.com 9999
That command prints the journal log information of the prior boot cycle (the one which you stopped with the power button) in reverse order (so the reason for the freeze should be near the top) and sends it to termbin. It will return with a url address that you should post should you want us to help you analyze it. It may be the mouse is the issue, but perhaps something else is a factor as well. That file could help determine that.
atirage wrote:
Sat May 22, 2021 9:26 am
Some additional hints:
  • it doesn't happen if I'm not moving the cursor(mouse or touchpad)
  • when it occurs, I'm getting these events in the Xorg log:

    Code: Select all

    [ 25965.715] (II) event6  - Microsoft Microsoft® Nano Transceiver v2.0 Mouse: SYN_DROPPED event - some input events have been lost.
    [ 26111.065] (II) event11 - Elan Touchpad: SYN_DROPPED event - some input events have been lost.
    
This thread Xorg: High CPU Usage (94%) on Moving Mouse (Ubuntu 18.04) seems to be a similar situation.

I would suggest trying a different port for the mouse (if one is available) and see if that helps. Or you could try the mousepoll parameter mentioned in the thread.
A woman typing on a laptop with LM20.1 Cinnamon.
atirage
Level 1
Level 1
Posts: 15
Joined: Sun Dec 08, 2019 9:35 am

Re: System hangs for a few seconds

Post by atirage »

I tried the suggested mousepoll parameter, but it didn't help. The same goes for plugging the mouse into a different port.
I'm not using the power button, just closing & opening the lid. Nevertheless, I can still send you the journalctl log if you still think it'll be relevant.
User avatar
SMG
Level 15
Level 15
Posts: 5584
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: System hangs for a few seconds

Post by SMG »

atirage wrote:
Mon May 24, 2021 2:53 pm
I'm not using the power button, just closing & opening the lid.
You are able to unfreeze the system by closing and opening the lid? That does not really sound like a system freeze. That sounds like something may be running in the background which is causing a problem.

After closing and opening the lid, run dmesg -T | tail -n 200 to see if you can determine what is causing the issue.
A woman typing on a laptop with LM20.1 Cinnamon.
atirage
Level 1
Level 1
Posts: 15
Joined: Sun Dec 08, 2019 9:35 am

Re: System hangs for a few seconds

Post by atirage »

Sorry, if my description was not clear enough, when I say freeze or hang, I mean those 1.5-2 sec while the system is completely unresponsive, but after that everything runs fine, until the next such event occurs(usually tens of seconds later).
The connection to the sleep event is, that after I updated the kernel, I noticed the behavior again only after waking up the laptop on battery power.

BTW, I also found this:
https://bugs.launchpad.net/ubuntu/+sour ... ug/1870597, so this seems to be a known issue.
User avatar
SMG
Level 15
Level 15
Posts: 5584
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: System hangs for a few seconds

Post by SMG »

atirage wrote:
Mon May 24, 2021 3:48 pm
Sorry, if my description was not clear enough, when I say freeze or hang, I mean those 1.5-2 sec while the system is completely unresponsive, but after that everything runs fine, until the next such event occurs(usually tens of seconds later).
In that type of situation, I would recommend the dmesg command to try and determine the source of the issue. You can adjust the number 200 to get more or less lins.
atirage wrote:
Mon May 24, 2021 3:48 pm
BTW, I also found this:
https://bugs.launchpad.net/ubuntu/+sour ... ug/1870597, so this seems to be a known issue.
That indicates, "During the freeze, the output of the install had a message from "gdm-x-session" saying "your system is too slow"."

Linux Mint does not use gdm. It uses Light-DM, but Mint does use mutter so if mutter is the issue then it may apply to your situation.
A woman typing on a laptop with LM20.1 Cinnamon.
atirage
Level 1
Level 1
Posts: 15
Joined: Sun Dec 08, 2019 9:35 am

Re: System hangs for a few seconds

Post by atirage »

Linux Mint does not use gdm. It uses Light-DM, but Mint does use mutter so if mutter is the issue then it may apply to your situation.
From what I can see and understand from the comments on the bug tracker, this issue seems to present in other configurations as well, just that those are marked as duplicates of the one I sent you.

dmesg I already checked, there were no entries to be correlated with the issue.

Additionally, yesterday I restarted the light-dm by:

Code: Select all

sudo systemctl restart lightdm
and the issue went away, so I guess I'll just have to wait till that issue is resolved, unless you have other suggestions.
User avatar
SMG
Level 15
Level 15
Posts: 5584
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: System hangs for a few seconds

Post by SMG »

atirage wrote:
Tue May 25, 2021 4:32 pm
unless you have other suggestions.
I do not, but I'm glad to hear you found a workaround.
A woman typing on a laptop with LM20.1 Cinnamon.
Post Reply