jtsiomb / xlivebg

Live wallpapers for the X window system
http://nuclear.mutantstargoat.com/sw/xlivebg
GNU General Public License v3.0
80 stars 8 forks source link

Stuck on start, cpu usage 100% and ping failed #3

Open Chinory opened 3 years ago

Chinory commented 3 years ago

OS: Arch Linux

Desktop: GNOME 3.38.3

Installed from: AUR

Version: xlivebg 1.0-1

GLX Info:

> glxinfo -B
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel Open Source Technology Center (0x8086)
    Device: Mesa DRI Intel(R) HD Graphics
    Version: 20.3.3
    Accelerated: yes
    Video memory: 1536MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.5
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.1
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics
OpenGL core profile version string: 4.5 (Core Profile) Mesa 20.3.3
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 3.0 Mesa 20.3.3
OpenGL shading language version string: 1.30
OpenGL context flags: (none)

OpenGL ES profile version string: OpenGL ES 3.1 Mesa 20.3.3
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10

Config:

> cat ~/.config/xlivebg.conf
#...
xlivebg {
image = ".wallpaper/0.png"
ripple {
raindrops = 10
#...

xlivebg -p output:

> xlivebg -p
Using config file: /home/user/.config/xlivebg.conf
output: 800x600
xlivebg: searching for plugins in /usr/lib/xlivebg
xlivebg: registered plugin: video
xlivebg: registered plugin: stars
xlivebg: registered plugin: distort
xlivebg: registered plugin: ripple
xlivebg: registered plugin: colcycle
xlivebg: activating plugin: video
window size: 800x600
window visual: e5
 double-buffered RGBA 888, 24 bits zbuffer

The preview window is all black, cpu usage 100% and ping failed

jtsiomb commented 3 years ago

Interesting...

Does it do that when it runs on the desktop too? (without the preview window option)

Does it do the same when you select one of the other wallpaper plugins other than "video" in the config file?

Also, can you run with gdb, stop it with ctrl-c, and print a backtrace with bt to see where it gets stuck? If the AUR binary doesn't come with debug symbols, you might need to build from source in order to get a meaningful backtrace.

Chinory commented 3 years ago

Does it do that when it runs on the desktop too? (without the preview window option)

xlivebg display nothing xlivebg -n black desktop

Does it do the same when you select one of the other wallpaper plugins other than "video" in the config file?

Yes, I selected the "distort" with default config

Also, can you run with gdb, stop it with ctrl-c, and print a backtrace with bt to see where it gets stuck?

> gdb xlivebg
GNU gdb (GDB) 10.1
Copyright (C) 2020 Free Software Foundation, Inc.                                                        
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from xlivebg...
(No debugging symbols found in xlivebg)
(gdb) run
Starting program: /usr/bin/xlivebg 
detected root window: 137
Using config file: /home/user/.config/xlivebg.conf
detected 1 outputs:
 [0] DP2: 1920x1080+0+0
xlivebg: searching for plugins in /usr/lib/xlivebg
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
xlivebg: registered plugin: video
xlivebg: registered plugin: stars
xlivebg: registered plugin: distort
xlivebg: registered plugin: ripple
xlivebg: registered plugin: colcycle
xlivebg: activating plugin: video
window size: 1920x1080
[New Thread 0x7fffee082640 (LWP 79171)]
[New Thread 0x7fffed881640 (LWP 79172)]
[New Thread 0x7fffed080640 (LWP 79173)]
[New Thread 0x7fffec87f640 (LWP 79174)]
window visual: 20
 double-buffered RGBA 888, 24 bits zbuffer

Thread 1 "xlivebg" received signal SIGSEGV, Segmentation fault.
0x00007ffff7fab7b2 in __pthread_clockjoin_ex () from /usr/lib/libpthread.so.0
(gdb) Quit
(gdb) bt
#0  0x00007ffff7fab7b2 in __pthread_clockjoin_ex () from /usr/lib/libpthread.so.0
#1  0x00007ffff7fc57d7 in ?? () from /usr/lib/xlivebg/video.so
#2  0x00007ffff7fc5bd5 in ?? () from /usr/lib/xlivebg/video.so
#3  0x00005555555601f1 in activate_plugin ()
#4  0x000055555555c191 in app_init ()
#5  0x000055555555b8b3 in main ()
jtsiomb commented 3 years ago

There's no debug info in the video plugin, but it looks like it's blocking on pthread_join, which should only be called in the "stop" function. That's strange, and I'll have to look into the sequence of events, and why video ends up being activated at all in the first place, and then gets apparetly de-activated later...

But first, this leads me to beleive that the problem is wholly with the video plugin, and not the rest of the system. Can you just delete /usr/lib/xlivebg/video.so, or rename it to video.bak if you prefer, and let me know what happens?

Also please paste the whole unabbreviated contents of your /home/user/.config/xlivebg.conf file.

Chinory commented 3 years ago

...or rename it to video.bak if you prefer, and let me know what happens?

Done. It starts normally and has a configurable screen and excellent 0% cpu consumption.

I'm using GNOME.

Also please paste the whole unabbreviated contents of your /home/user/.config/xlivebg.conf file.

# example xlivebg configuration file
# copy to one of the following locations, and customize:
#
#   ~/.xlivebg/config
#   ~/.config/xlivebg.conf  (preferred user configuration file)
#   /etc/xlivebg.conf       (system-wide configuration)
#
# The config paths are searched in the order listed, and the first one found
# will be used; the rest, if they exist, are ignored. So if you have a
# system-wide config in /etc and you wish to override one option for a specific
# user, copy the whole file over, and modify it.

xlivebg {
        # active plugin
        # This will select which of the currently available live wallpaper
        # plugins will be used. If you start xlivebg without this option set, an
        # arbitrary plugin will be selected, and the list of all available
        # plugins will be printed.
        #active = colcycle

        # background image
        # This will instruct any live wallpapers which have use for a background
        # image, to use this one.
        # Accepted file formats: JPEG, PNG, Portable Pixmap (PPM), Targa (TGA),
        #      Radiance RGBE, LBM/ILBM.
        image = "/home/user/.wallpaper/0.png"

        # animation mask
        # This will define an image to be used as an animation (motion) mask,
        # for live wallpapers which support that. White areas allow motion,
        # black areas inhibit motion. Same file formats are accepted as for the
        # image option above, but will be converted to greyscale before use.
        #anim_mask = "bgmask.png"

        # background color mode
        # options:
        #   - "solid": fill the background with a solid color.
        #   - "vgrad": vertical gradient between color and color2.
        #   - "hgrad": horizontal gradient between color and color2.
        #bgmode = "solid"

        # background solid, or gradient start, color
        #color = [0.278, 0.275, 0.388]
        # background gradient end color
        #color2 = [0.322, 0.149, 0.235]

        # framerate override
        # Use this to force a specific framerate across all live wallpapers,
        # regardless of what the live wallpaper itself specifies (not recommended)
        # use -1 or comment-out to disable
        #fps = 30

        # wallpaper screen fit
        # Use this option to specify what to do when the wallpaper and the
        # screen have different aspect ratios.
        #   options:
        #     - "full": fit the image to the screen, leaving background-colored
        #       bars if necessary.
        #     - "crop": zoom all the way in and crop the image. the "crop_dir"
        #       option can be used to adjust which areas will be cropped.
        #     - "stretch": stretch the image to fill the screen, distorting the
        #       aspect ratio if necessary.
        #fit = "full"

        # crop direction
        # Use this option in conjunction with the "crop" fit, to select which
        # part of the image will be visible after cropping (if cropping is
        # necessary).
        # This option is a vector, specifying the quadrant that will be always
        # in the visible part:  /---------+---------+---------\
        #                       | [-1, 1] | [ 0, 1] | [ 1, 1] |
        #                       +---------+---------+---------+
        #                       | [-1, 0] | [ 0, 0] | [ 1, 0] |
        #                       +---------+---------+---------+
        #                       | [-1,-1] | [ 0,-1] | [ 1,-1] |
        #                       \---------+---------+---------/
        #crop_dir = [0, 0]

        # --- plugin-specific configuration ---
        distort {
                # amplitude of the distortion
                amplitude = 0.025
                # spatial frequency of the distortion
                frequency = 8.0
        }

        #colcycle {
                # The colcycle plugin uses special color-cycling images, so it
                # ignores the global image setting and uses this one instead.
                # Supported formats: LBM and JSON for canvascycle images
                # (see: https://github.com/jtsiomb/colcycle/wiki )
                #image = "/home/nuclear/images/colcycle/mjf_js/v29pm.js"

                # Instead of a single image, you can also specify a directory
                # with color-cycling images. If both image and imagedir are
                # specified, image takes precedence.
                #imagedir = "/home/nuclear/images/colcycle/mjf_js"
        #}

        #stars {
                # Total number of stars
                #count = 3000

                # Travel speed
                #speed = 5.0

                # Star size
                #size = 1.5

                # Star color
                #color = [1, 1, 1]

                # Magnitude of movement used to follow the mouse pointer
                # (set to 0 to disable mouse following).
                #follow = 0.25

                # Speed of mouse following. Lower values produce smooth motion,
                # higher values make the view snap to the mouse movement much
                # faster.
                #follow_speed = 0.6
        #}

        ripple {
                # Number of raindrops to spawn per second (0 to disable rain)
                raindrops = 10
        }

        #video {
                # Path to a video file to use as a wallpaper
                #video = "/home/nuclear/video/bgvid/singletree.mp4"
        #}
}
jtsiomb commented 3 years ago

Excellent. Thanks for the report. I'll try to reproduce the video plugin issue, and also fix the redundant start/stop issue during init. For now just keep the video plugin out as a workaround.

SolitudeSF commented 3 years ago

im guessing my issue is related. xlivebg isnt stuck on start, but gets stuck when i select video plugin.

jtsiomb commented 3 years ago

There are two problems here.

  1. video plugin getting stuck when it's about to be disabled due to a deadlock with the playback thread, which unfortunately I can't seem to reproduce here, but I will go through the code and see if I can locate a mistake or rewrite that part.
  2. The other is that in the OP's case the video plugin gets automatically enabled at startup, and then immediately disabled again to enable the selected plugin, which triggers the video deadlock bug. This one should be easy to solve when I get some time to look into it. It's probably just wrong sequencing during init. Plugin start should be delayed until after the selection is determined.

Also another approach would be to just isolate the plugins into their own process and being able to kill them and continue if one gets stuck or crashes. Long term this is the better solution, but will need some restructuring.

@SolitudeSF If you want to verify it's the same issue, please grab a stack backtrace after the video plugin gets stuck.

fbievan commented 3 years ago

Got the exact same issue, looks like the exact same backtrace here, also whats more fun is all my windows start flashing with xlivebg Here's gdb without remoing video

GNU gdb (GDB) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from xlivebg...
(No debugging symbols found in xlivebg)
(gdb) run
Starting program: /usr/bin/xlivebg
detected root window: 25c
Using config file: /etc/xlivebg.conf
ts_load: failed to open file: /etc/xlivebg.conf: No such file or directory
failed to load config file
detected 2 outputs:
 [0] HDMI-0: 1920x1080+0+0
 [1] eDP-1-1: 1920x1080+1920+0
xlivebg: searching for plugins in /usr/lib/xlivebg
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
xlivebg: registered plugin: video
xlivebg: registered plugin: colcycle
xlivebg: registered plugin: distort
xlivebg: registered plugin: stars
xlivebg: registered plugin: ripple
xlivebg: activating plugin: video
window size: 3840x1080
window visual: 21
 double-buffered RGBA 888, 24 bits zbuffer

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7fa9662 in __pthread_clockjoin_ex () from /usr/lib/libpthread.so.0
(gdb) bt
#0  0x00007ffff7fa9662 in __pthread_clockjoin_ex () at /usr/lib/libpthread.so.0
#1  0x00007ffff7fc2815 in  () at /usr/lib/xlivebg/video.so
#2  0x00007ffff7fc2c09 in  () at /usr/lib/xlivebg/video.so
#3  0x0000555555560445 in activate_plugin ()
#4  0x000055555555c171 in app_init ()
#5  0x000055555555b8bf in main ()
(gdb) 

Exact same issue