yshui / picom

A lightweight compositor for X11 with animation support
https://picom.app/
Other
4.19k stars 589 forks source link

Segfaults on SIGINT #209

Closed sooqua closed 5 years ago

sooqua commented 5 years ago

Platform

Arch Linux x86_64 5.2.3-arch1-1-ARCH

GPU, drivers, and screen setup

NVIDIA Quadro K1100M, NVIDIA 430.34, one monitor (laptop)

Environment

Awesome WM. No DE.

Compton version

v7

Compton configuration:

compton.conf.example

```sh # Shadow shadow = true; shadow-radius = 7; shadow-offset-x = -7; shadow-offset-y = -7; log-level = "warn"; # log-file = "/path/to/your/log/file"; # shadow-opacity = 0.7; # shadow-red = 0.0; # shadow-green = 0.0; # shadow-blue = 0.0; shadow-exclude = [ "name = 'Notification'", "class_g = 'Conky'", "class_g ?= 'Notify-osd'", "class_g = 'Cairo-clock'", "_GTK_FRAME_EXTENTS@:c" ]; # shadow-exclude = "n:e:Notification"; # shadow-exclude-reg = "x10+0+0"; # xinerama-shadow-crop = true; # Opacity inactive-opacity = 0.8; # active-opacity = 0.8; frame-opacity = 0.7; inactive-opacity-override = false; # inactive-dim = 0.2; # inactive-dim-fixed = true; # blur-background = true; # blur-background-frame = true; blur-kern = "3x3box"; # blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"; # blur-background-fixed = true; blur-background-exclude = [ "window_type = 'dock'", "window_type = 'desktop'", "_GTK_FRAME_EXTENTS@:c" ]; # opacity-rule = [ "80:class_g = 'URxvt'" ]; # Fading fading = true; # fade-delta = 30; fade-in-step = 0.03; fade-out-step = 0.03; # no-fading-openclose = true; # no-fading-destroyed-argb = true; fade-exclude = [ ]; # Other backend = "xrender"; mark-wmwin-focused = true; mark-ovredir-focused = true; # use-ewmh-active-win = true; detect-rounded-corners = true; detect-client-opacity = true; refresh-rate = 0; vsync = true; # sw-opti = true; # unredir-if-possible = true; # unredir-if-possible-delay = 5000; # unredir-if-possible-exclude = [ ]; focus-exclude = [ "class_g = 'Cairo-clock'" ]; detect-transient = true; detect-client-leader = true; invert-color-include = [ ]; # resize-damage = 1; # GLX backend # glx-no-stencil = true; # glx-no-rebind-pixmap = true; # xrender-sync-fence = true; use-damage = true; # Window type settings wintypes: { tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; }; dock = { shadow = false; } dnd = { shadow = false; } popup_menu = { opacity = 0.8; } dropdown_menu = { opacity = 0.8; } }; ```

Steps of reproduction

  1. $ compton
  2. <C-c> or pkill -2 compton

Expected behavior

Graceful termination

Current Behavior

[1] 22590 segmentation fault (core dumped) compton

Stack trace

coredumpctl info 22590

``` PID: 22590 (compton) GID: 985 (users) Signal: 11 (SEGV) Command Line: compton Executable: /usr/bin/compton Control Group: /user.slice/user-1000.slice/session-2.scope Unit: session-2.scope Slice: user-1000.slice Session: 2 Hostname: arch Message: Process 22590 (compton) of user 1000 dumped core. Stack trace of thread 22590: #0 0x0000557da58a056f n/a (compton) #1 0x0000557da587c0b7 n/a (compton) #2 0x00007fca495d4ee3 __libc_start_main (libc.so.6) #3 0x0000557da587d1de n/a (compton) ```

yshui commented 5 years ago

I cannot reproduce this locally.

Can you build compton with debug info so the stack trace can be more useful?

Ropid commented 5 years ago

I see that bug here as well.

Here's my stack trace:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000055c6ea790e63 in discard_ignore (ps=0x0, sequence=5821) at ../src/compton.c:269
269     while (ps->ignore_head) {
[Current thread is 1 (Thread 0x7fce1561fdc0 (LWP 24681))]
(gdb) bt
#0  0x000055c6ea790e63 in discard_ignore (ps=0x0, sequence=5821) at ../src/compton.c:269
#1  0x000055c6ea790e98 in should_ignore (ps=0x0, sequence=5821) at ../src/compton.c:284
#2  0x000055c6ea792843 in xerror (dpy=0x55c6ebe41020, ev=0x7ffce9ec3d90) at ../src/compton.c:859
#3  0x00007fce16a1b50a in _XError () from /usr/lib/libX11.so.6
#4  0x00007fce16a18398 in ?? () from /usr/lib/libX11.so.6
#5  0x00007fce16a18445 in ?? () from /usr/lib/libX11.so.6
#6  0x00007fce16a19317 in _XReply () from /usr/lib/libX11.so.6
#7  0x00007fce16a14c3f in XSync () from /usr/lib/libX11.so.6
#8  0x00007fce169f63a9 in XCloseDisplay () from /usr/lib/libX11.so.6
#9  0x000055c6ea797654 in main (argc=1, argv=0x7ffce9ec40d8) at ../src/compton.c:2299

The compton version is this:

$ build/src/compton --version
v6-rc1-224-g5da71e6
sooqua commented 5 years ago

I cannot reproduce this locally.

Can you build compton with debug info so the stack trace can be more useful?

Sure, if you can tell me how to build with debug symbols. I'm building from AUR package, I tried changing --buildtype=release to debug, passing CFLAGS, LDFLAGS, and CPPFLAGS with -g, and modifying meson.build file with the same options, but it still generates make-release.sh file instead of debug and objdump /usr/bin/compton --syms shows no symbols. Using the short gdb instructions from new issue template, I get this, if this is any useful:

Program received signal SIGINT, Interrupt.
0x00007ffff71b63db in epoll_wait () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff71b63db in epoll_wait () from /usr/lib/libc.so.6
#1  0x00007ffff7e5acd4 in ?? () from /usr/lib/libev.so.4
#2  0x00007ffff7e5d29e in ev_run () from /usr/lib/libev.so.4
#3  0x0000555555567355 in ?? ()
#4  0x0000555555567604 in ?? ()
#5  0x00007ffff70e0ee3 in __libc_start_main () from /usr/lib/libc.so.6
#6  0x000055555555faae in ?? ()
(gdb) q
yshui commented 5 years ago

@Ropid I pushed a change that should fix your crash.

@sooqua Can you try the latest next and see if it fix your problem as well?

sooqua commented 5 years ago

@Ropid I pushed a change that should fix your crash.

@sooqua Can you try the latest next and see if it fix your problem as well?

^C[1] 18549 segmentation fault (core dumped) compton Nope

$ compton --version
v6-rc1-226-g6cb5f97
yshui commented 5 years ago

@sooqua if you build from AUR, you need to add options=('!strip') to your PKGBUILD to get debug symbols

Ropid commented 5 years ago

I'm now seeing this output here when I interrupt it:

$ build/src/compton
^CX Error of failed request:  GLXBadPixmap
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  23 (X_GLXDestroyPixmap)
  Serial number of failed request:  5633
  Current serial number in output stream:  5640

It does not crash, there's no segfault or anything. I'm just worrying about that output. It looks a bit concerning.

When I send a TERM signal (using pkill compton) instead of an INT signal, then it prints the following:

$ build/src/compton
Terminated

The version is this:

$ build/src/compton --version
v6-rc1-226-g6cb5f97
sooqua commented 5 years ago
$ coredumpctl info
Stack trace of thread 23644:
                #0  0x0000558fedb13cf6 deinit_render (compton)
                #1  0x0000558fedafc164 session_destroy (compton)
                #2  0x0000558fedafc64b main (compton)
                #3  0x00007f30ebdc9ee3 __libc_start_main (libc.so.6)
                #4  0x0000558fedaf4aae _start (compton)

It doesn't seem to crash under gdb, am I doing something wrong?

(gdb) run
Starting program: /usr/bin/compton
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
^C
Program received signal SIGINT, Interrupt.
0x00007ffff71b63db in epoll_wait () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff71b63db in epoll_wait () from /usr/lib/libc.so.6
#1  0x00007ffff7e5acd4 in ?? () from /usr/lib/libev.so.4
#2  0x00007ffff7e5d29e in ev_run () from /usr/lib/libev.so.4
#3  0x0000555555567379 in session_run (ps=0x5555555beda0) at ../src/compton.c:2213
#4  0x0000555555567628 in main (argc=1, argv=0x7fffffffe108) at ../src/compton.c:2295
(gdb) q
A debugging session is active.

    Inferior 1 [process 24164] will be killed.

Quit anyway? (y or n) y
sooqua commented 5 years ago

Okay, took some gdb courses. Here:

(gdb) handle 2 pass
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) y
Signal        Stop  Print   Pass to program Description
SIGINT        Yes   Yes Yes     Interrupt
(gdb) run
Starting program: /usr/bin/compton
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
^C
Program received signal SIGINT, Interrupt.
0x00007ffff71b63db in epoll_wait () from /usr/lib/libc.so.6
(gdb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x000055555557ecf6 in deinit_render (ps=0x5555555beda0) at ../src/render.c:1220
warning: Source file is more recent than executable.
1220            free(ps->blur_kerns_cache[i]);
(gdb) q

render.c:1220

yshui commented 5 years ago

@sooqua Thanks for your help.

Fixed in next.