Xorg Memory Hog / Trouble with Caffeine [SOLVED]

Report Bugs, Issues and non- package Requests
Message
Author
User avatar
h3kt0r
Posts: 144
Joined: Fri Oct 08, 2021 6:27 pm

Xorg Memory Hog / Trouble with Caffeine [SOLVED]

#1 Post by h3kt0r »

Code: Select all

System:    Kernel: 6.7.12-1-liquorix-amd64 [6.7-18~mx21ahs] x86_64 bits: 64 compiler: gcc v: 10.2.1 
           parameters: audit=0 intel_pstate=disable rcupdate.rcu_expedited=1 ro root=UUID=<filter> 
           quiet splash zswap.enabled=1 zswap.compressor=lz4 zswap.max_pool_percent=40 
           zswap.zpool=z3fold i915.enable_psr=0 initrd=\boot\initrd.img-6.7.12-1-liquorix-amd64 
           Desktop: Blackbox 0.77 info: lxpanel, wbar vt: 7 dm: LightDM 1.26.0 
           Distro: MX-21.3_x64 Wildflower October 20  2021 base: Debian GNU/Linux 11 (bullseye) 
Machine:   Type: Laptop System: Panasonic product: CFMX4-1 v: 001 serial: <filter> Chassis: 
           type: 10 v: 001 serial: <filter> 
           Mobo: Panasonic model: CFMX4-1 v: 1 serial: <filter> UEFI: American Megatrends 
           v: 1.00L16 date: 07/08/2019 
Battery:   ID-1: BAT1 charge: 18.5 Wh (80.1%) condition: 23.1/32.8 Wh (70.4%) volts: 7.8 min: 7.2 
           model: Panasonic CF-VZSU92 type: Li-ion serial: <filter> status: Not charging 
           ID-2: BAT2 charge: 11.7 Wh (100.0%) condition: 11.7/15.2 Wh (76.7%) volts: 8.4 min: 7.6 
           model: Panasonic 2-644553-B01 type: Li-ion serial: <filter> status: Not charging 
CPU:       Info: Dual Core model: Intel Core i5-5300U bits: 64 type: MT MCP arch: Broadwell 
           family: 6 model-id: 3D (61) stepping: 4 microcode: 2F cache: L2: 3 MiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 18356 
           Speed: 798 MHz min/max: 500/2301 MHz boost: enabled Core speeds (MHz): 1: 800 2: 798 
           3: 798 4: 798 
           Vulnerabilities: Type: gather_data_sampling status: Not affected 
           Type: itlb_multihit status: KVM: VMX disabled 
           Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
           Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
           Type: meltdown mitigation: PTI 
           Type: mmio_stale_data status: Unknown: No mitigations 
           Type: reg_file_data_sampling status: Not affected 
           Type: retbleed status: Not affected 
           Type: spec_rstack_overflow status: Not affected 
           Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl 
           Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization 
           Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW, STIBP: 
           conditional, RSB filling, PBRSB-eIBRS: Not affected 
           Type: srbds mitigation: Microcode 
           Type: tsx_async_abort mitigation: Clear CPU buffers; SMT vulnerable 
Graphics:  Device-1: Intel HD Graphics 5500 vendor: Matsushita driver: i915 v: kernel 
           bus-ID: 00:02.0 chip-ID: 8086:1616 class-ID: 0300 
           Display: x11 server: X.Org 1.20.11 compositor: compton v: 1 driver: loaded: i915 
           note: n/a (using device driver) alternate: intel display-ID: :0.0 screens: 1 
           Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") 
           s-diag: 582mm (22.9") 
           Monitor-1: eDP-1 res: 1920x1080 hz: 60 dpi: 176 size: 277x156mm (10.9x6.1") 
           diag: 318mm (12.5") 
           OpenGL: renderer: Mesa Intel HD Graphics 5500 (BDW GT2) v: 4.6 Mesa 20.3.5 
           direct render: Yes 
Audio:     Device-1: Intel Broadwell-U Audio vendor: Matsushita driver: snd_hda_intel v: kernel 
           bus-ID: 00:03.0 chip-ID: 8086:160c class-ID: 0403 
           Device-2: Intel Wildcat Point-LP High Definition Audio vendor: Matsushita 
           driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:9ca0 class-ID: 0403 
           Device-3: Creative Sound BlasterX G1 type: USB driver: hid-generic,snd-usb-audio,usbhid 
           bus-ID: 2-2.1:37 chip-ID: 041e:3249 class-ID: 0300 serial: <filter> 
           Sound Server-1: ALSA v: k6.7.12-1-liquorix-amd64 running: yes 
           Sound Server-2: PulseAudio v: 14.2 running: yes 
           Sound Server-3: PipeWire v: 0.3.19 running: no 
Network:   Device-1: Intel Ethernet I218-LM vendor: Matsushita driver: e1000e v: kernel port: f080 
           bus-ID: 00:19.0 chip-ID: 8086:15a2 class-ID: 0200 
           IF: eth0 state: down mac: <filter> 
           Device-2: Intel Wireless 7265 driver: iwlwifi v: kernel port: f040 bus-ID: 02:00.0 
           chip-ID: 8086:095a class-ID: 0280 
           IF: wlan0 state: up mac: <filter> 
Bluetooth: Device-1: Intel Bluetooth wireless interface type: USB driver: btusb v: 0.8 
           bus-ID: 2-4:5 chip-ID: 8087:0a2a class-ID: e001 
           Report: hciconfig ID: hci0 rfk-id: 1 state: up address: <filter> bt-v: 2.1 lmp-v: 4.2 
           sub-v: 1000 hci-v: 4.2 rev: 1000 
           Info: acl-mtu: 1021:5 sco-mtu: 96:6 link-policy: rswitch hold sniff 
           link-mode: slave accept service-classes: rendering, capturing, object transfer, audio 
Drives:    Local Storage: total: 4.89 TiB used: 3.15 TiB (64.4%) 
           ID-1: /dev/mmcblk0 maj-min: 179:0 type: Removable model: SDU1 size: 232.96 GiB 
           block-size: physical: 512 B logical: 512 B type: SSD serial: <filter> scheme: MBR 
           SMART Message: Unknown smartctl error. Unable to generate data. 
           ID-2: /dev/sda maj-min: 8:0 vendor: Western Digital model: WDS100T2B0B-00YS70 
           size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s type: SSD 
           serial: <filter> rev: 00WD scheme: GPT 
           SMART Message: Unknown smartctl error. Unable to generate data. 
           ID-3: /dev/sdb maj-min: 8:16 type: USB vendor: Seagate model: Expansion HDD 
           size: 3.64 TiB block-size: physical: 4096 B logical: 512 B type: N/A serial: <filter> 
           rev: 1801 scheme: GPT 
           SMART Message: A mandatory SMART command failed. Various possible causes. 
           ID-4: /dev/sdc maj-min: 8:32 type: USB model: USB DISK 3.0 size: 115.63 GiB block-size: 
           physical: 512 B logical: 512 B type: N/A serial: <filter> rev: PMAP scheme: MBR 
           SMART Message: Unknown USB bridge. Flash drive/Unsupported enclosure? 
Partition: ID-1: / raw-size: 29.3 GiB size: 28.67 GiB (97.86%) used: 14.23 GiB (49.7%) fs: ext4 
           block-size: 4096 B dev: /dev/sda3 maj-min: 8:3 
           ID-2: /boot/efi raw-size: 260 MiB size: 256 MiB (98.46%) used: 28.7 MiB (11.2%) 
           fs: vfat block-size: 512 B dev: /dev/sda1 maj-min: 8:1 
           ID-3: /home raw-size: 244.14 GiB size: 239.25 GiB (98.00%) used: 183.82 GiB (76.8%) 
           fs: ext4 block-size: 4096 B dev: /dev/sda9 maj-min: 8:9 
Swap:      Kernel: swappiness: 25 (default 60) cache-pressure: 100 (default) 
           ID-1: swap-1 type: partition size: 3.91 GiB used: 1.95 GiB (49.8%) priority: -2 
           dev: /dev/sda7 maj-min: 8:7 
Sensors:   System Temperatures: cpu: 65.4 C mobo: 65.4 C 
           Fan Speeds (RPM): N/A 
Repos:     Packages: note: see --pkg apt: 3298 lib: 1598 flatpak: 0 
           No active apt repos in: /etc/apt/sources.list 
           Active apt repos in: /etc/apt/sources.list.d/brave-browser-release.list 
           1: deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main
           Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list 
           1: deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free
           Active apt repos in: /etc/apt/sources.list.d/debian.list 
           1: deb http://deb.debian.org/debian/ bullseye non-free contrib main
           2: deb http://security.debian.org/debian-security/ bullseye-security non-free contrib main
           Active apt repos in: /etc/apt/sources.list.d/mx.list 
           1: deb https://mirrors.aliyun.com/mxlinux/mx/repo/ bullseye non-free main
           No active apt repos in: /etc/apt/sources.list.d/opera-stable.list 
           No active apt repos in: /etc/apt/sources.list.d/signal-xenial.list 
           No active apt repos in: /etc/apt/sources.list.d/steam-beta.list 
           Active apt repos in: /etc/apt/sources.list.d/steam-stable.list 
           1: deb [arch=amd64,i386 signed-by=/usr/share/keyrings/steam.gpg] https://repo.steampowered.com/steam/ stable steam
           2: deb-src [arch=amd64,i386 signed-by=/usr/share/keyrings/steam.gpg] https://repo.steampowered.com/steam/ stable steam
           Active apt repos in: /etc/apt/sources.list.d/syncthing.list 
           1: deb https://apt.syncthing.net/ syncthing stable
Info:      Processes: 337 Uptime: 27d 20h 46m wakeups: 2 Memory: 3.73 GiB used: 3.04 GiB (81.5%) 
           Init: SysVinit v: 2.96 runlevel: 5 default: 5 tool: systemctl Compilers: gcc: 10.2.1 
           alt: 10 Client: shell wrapper v: 5.1.4-release inxi: 3.3.06 
Boot Mode: UEFI
Long story shortened : "caffeine" is broken on my system so i went to launch "xfce4-power-manager"
to activate "presentation mode" to be able to watch full videos wthout the display turning off.
Went through a memory leak that affected "xorg" that ate up to 31% of available RAM.
Killed "xfce4-power-manager" and a few moments later, "xorg" was using 11% of available RAM.
5 minutes later, "xorg" was using 7% of available RAM.

Conclusion : "xfce4-power-manager" has most probably a very nasty bug in its code :bagoverhead: ...

Is there an alternative to the "caffeine" package ? I looked everywhere and couldn't find one...
Last edited by h3kt0r on Wed Jun 19, 2024 12:42 am, edited 3 times in total.
Dell OptiPlex 7010 - i7-3770 (8) @ 3.9GHz - 16Gb RAM - GeForce GT 1030 - MX 21
Panasonic CF MX4 - i5-5300U vPro (4) @ 2.9GHz - 4Gb RAM - HD Graphics 5500 - MX 21
Acer Aspire One ZG5 - Atom (2) @ 1.6GHz - 1.5Gb RAM - HD Gfx 945 - LXLE & XenialPup

User avatar
Eadwine Rose
Administrator
Posts: 14699
Joined: Wed Jul 12, 2006 2:10 am

Re: Xorg Memory Hog

#2 Post by Eadwine Rose »

To note: your posts are a bit easier to read if you don't use bolding that much.
MX-23.6_x64 July 31 2023 * 6.1.0-37amd64 ext4 Xfce 4.20.0 * 8-core AMD Ryzen 7 2700
Asus TUF B450-Plus Gaming UEFI * Asus GTX 1050 Ti Nvidia 535.247.01 * 2x16Gb DDR4 2666 Kingston HyperX Predator
Samsung 870EVO * Samsung S24D330 & P2250 * HP Envy 5030

Charlie Brown

Re: Xorg Memory Hog

#3 Post by Charlie Brown »

What about turning off the "Display Power Management" (in "Display" tab in Power Manager) ?

(... Or set all items to "never" in both sub-tabs: When on battery / When Plugged in )

User avatar
h3kt0r
Posts: 144
Joined: Fri Oct 08, 2021 6:27 pm

Re: Xorg Memory Hog

#4 Post by h3kt0r »

@Eadwine Rose : sorry for the inconvenience !
@Charlie Brown : I still need DPM to turn off the screen when the laptop is iddling...

ATM, Xorg is using 1.83% of the total RAM.

I uninstalled, reinstalled, purged "Caffeine", no matter what i try, it does not work anymore.
Just throwing this at the CLI :

Code: Select all

File "/usr/bin/caffeine-indicator", line 34, in <module> from Xlib import display
Dell OptiPlex 7010 - i7-3770 (8) @ 3.9GHz - 16Gb RAM - GeForce GT 1030 - MX 21
Panasonic CF MX4 - i5-5300U vPro (4) @ 2.9GHz - 4Gb RAM - HD Graphics 5500 - MX 21
Acer Aspire One ZG5 - Atom (2) @ 1.6GHz - 1.5Gb RAM - HD Gfx 945 - LXLE & XenialPup

User avatar
DukeComposed
Posts: 1423
Joined: Thu Mar 16, 2023 1:57 pm

Re: Xorg Memory Hog

#5 Post by DukeComposed »

h3kt0r wrote: Mon Jun 17, 2024 11:02 am Just throwing this at the CLI :

Code: Select all

File "/usr/bin/caffeine-indicator", line 34, in <module> from Xlib import display
caffeine-indicator is a Python script, so you probably just need to add a dependency. I suspect a web search of the error message will provide a stackoverlow page outlining which Python package is needed. python3-xlib stands out as a possible culprit.

I turned on top, htop, xfce4-power-manager, and presentation mode and left a video playing on loop. After leaving it for two hours my laptop's CPU went up to 91C, but Xorg DRAM usage stayed about the same and actually dropped a little. Of course, I'm running Xfce on 16 GB of DRAM and not Blackbox on 4 GB, so that may be a factor.

User avatar
h3kt0r
Posts: 144
Joined: Fri Oct 08, 2021 6:27 pm

Re: Xorg Memory Hog / Trouble with Caffeine

#6 Post by h3kt0r »

Uninstalled "python3-xlib" then re-installed "caffeine" package with recommended dependencies.
This is the CLI output trying to run "Caffeine-indicator" :

Code: Select all

Traceback (most recent call last):
  File "/usr/bin/caffeine-indicator", line 34, in <module>
    from Xlib import display
  File "/usr/lib/python3/dist-packages/Xlib/display.py", line 26, in <module>
    from six import create_unbound_method
ImportError: cannot import name 'create_unbound_method' from 'six' (/usr/local/lib/python3.9/dist-packages/six.py)
And this is the CLI output after trying to run "caffeine" :

Code: Select all

Traceback (most recent call last):
  File "/usr/bin/caffeine", line 29, in <module>
    from ewmh import EWMH
  File "/usr/lib/python3/dist-packages/ewmh/__init__.py", line 3, in <module>
    from .ewmh import EWMH
  File "/usr/lib/python3/dist-packages/ewmh/ewmh.py", line 10, in <module>
    from Xlib import display, X, protocol
  File "/usr/lib/python3/dist-packages/Xlib/display.py", line 26, in <module>
    from six import create_unbound_method
ImportError: cannot import name 'create_unbound_method' from 'six' (/usr/local/lib/python3.9/dist-packages/six.py)
:bawling:
So, i've searched a little bit and found that : "The Python ImportError: cannot import name error occurs when an imported class is not accessible or is in a circular dependency."
9_9 Good to know. But i don't write Python code, so it won't help much in that case.

So, i've fired up "featherpad" and opened "/usr/local/lib/python3.9/dist-packages/six.py" to search for this string : "create_unbound_method".
I can confirm that it's nowhere to be found. There's no "create_unbound_method" in this file...

:snail: Going ahead to solve this exotic python mys(t)ery, i've found that :

Get defining class of unbound method object in Python 3
The concept of "unbound methods" has been removed from the language.
This was written in 2010. Almost 15 years ago.

The removal of unbound methods is documented here: http://docs.python.org/py3k/whatsnew/3.0.html#operators-and-special-methods

:needcoffee: I need caffeine.

Perhaps even something stronger : "caffeine-ng"
Caffeing-ng (since 2014) started as a fork of [Caffeine 2.4], since the original version dropped support for the systray icon in favour of only automatic detection of fullscreen apps only, which turned to be a rather controversial decision.

The intention of this fork is to also evolve on its own, not only fixing issues, but also implemented missing features, when relevant.

Caffeine-ng was shortly know as Taurine, a play on its successor's name, since taurine is a known stimulant, commonly found in energy drinks. However, this name did not last, since the artwork would not match adequately, and changing it was undesirable.
Riiiight ! Let's install it :

Code: Select all

sudo apt install meson \
    python-gi-dev \
    python-dbus-dev \
    libgtk-3-dev \
    libnotify-dev \
    libappindicator3-dev \
    python3-click \
    python3-ewmh \
    python3-setproctitle \
    python3-pulsectl \
    git \
    scdoc
Nope :
E: Unable to locate package python3-pulsectl
Damn it ! Let's remove "python3-pulsectl" from the packages list and try again :
The following packages have unmet dependencies:
libappindicator3-dev : Depends: libappindicator3-1 (= 0.4.92-8~mx21+1)
E: Unable to correct problems, you have held broken packages.
:rolleyes: Pffffff... No fun at all !
Dell OptiPlex 7010 - i7-3770 (8) @ 3.9GHz - 16Gb RAM - GeForce GT 1030 - MX 21
Panasonic CF MX4 - i5-5300U vPro (4) @ 2.9GHz - 4Gb RAM - HD Graphics 5500 - MX 21
Acer Aspire One ZG5 - Atom (2) @ 1.6GHz - 1.5Gb RAM - HD Gfx 945 - LXLE & XenialPup

User avatar
h3kt0r
Posts: 144
Joined: Fri Oct 08, 2021 6:27 pm

Re: Xorg Memory Hog / Trouble with Caffeine

#7 Post by h3kt0r »

Okay, so, i've found that this line :

Code: Select all

# Stop X from blanking
xset dpms 0 0 0 && xset s noblank && xset s off && xset -dpms &
inside my startup script was conflicting with "xfce-power-manager" and causing "Xorg" to eat up so much RAM.
Now, to fix caffeine failure to run on my system, i've found that this script does the job efficiently. Workaround.
Dell OptiPlex 7010 - i7-3770 (8) @ 3.9GHz - 16Gb RAM - GeForce GT 1030 - MX 21
Panasonic CF MX4 - i5-5300U vPro (4) @ 2.9GHz - 4Gb RAM - HD Graphics 5500 - MX 21
Acer Aspire One ZG5 - Atom (2) @ 1.6GHz - 1.5Gb RAM - HD Gfx 945 - LXLE & XenialPup

Post Reply

Return to “Bugs and Non-Package Requests Forum”