Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

startx results in a segfault #62

Closed
andornaut opened this issue Sep 24, 2013 · 11 comments
Closed

startx results in a segfault #62

andornaut opened this issue Sep 24, 2013 · 11 comments

Comments

@andornaut
Copy link

bspwm stopped working on my workstation as of 2c36390.

startx fails with the following in /var/log/syslog:

Sep 23 20:28:54 workstation acpid: client connected from 4092[0:0]
Sep 23 20:28:54 workstation acpid: 1 client rule loaded
Sep 23 20:28:55 workstation kernel: [  107.050820] NVRM: GPU at 0000:01:00: GPU-3736b905-88ce-b01a-e7f9-3e55a1fffb4c
Sep 23 20:28:55 workstation acpid: client connected from 4092[0:0]
Sep 23 20:28:55 workstation acpid: 1 client rule loaded
Sep 23 20:28:55 workstation kernel: [  107.387652] bspwm[4095]: segfault at 1f2000001f1 ip 000000000040d62a sp 00007fff4ab3dc40 error 4 in bspwm[400000+11000]

This is a dual-head workstation. I tested with an empty bspwmrc and a reduced .xinitrc:

[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
mkfifo "$PANEL_FIFO"
exec bspwm -s "$PANEL_FIFO" -p W

The same version of bspwm works on my laptop.

@baskerville
Copy link
Owner

Grab this patch and apply it to the standard Git PKGBUILD.

Install the package generated from this patched PKGBUILD.

(Afterwards, check that file $(which bspwm) ends with not stripped.)

In a virtual terminal (without X running):

ulimit -c unlimited
startx
sudo systemd-coredumpctl gdb bspwm
set logging on
bt full
q

And post the content of gdb.txt.

@baskerville
Copy link
Owner

Might be fixed by 48d181f.

@andornaut
Copy link
Author

I'm still experiencing the same issues with 48d181f.

I'm using Ubuntu which doesn't use PKGBUILD and also doesn't include systemd-coredumpctl. startx in the above instructions fails, though. Maybe I could try something else?

I did try installing via make debug && sudo make install. Now the /var/log/Xorg.0.log output contains:

import monitors
add monitor ...
add monitor ...
add desktop ...
xinit: connection to X server lost

I thought that perhaps this issue might be related so I checked the version of some dependencies:

When I install xcb-util-wm 0.3.9 from fedora 19, bspwm can start without segfaulting.

My advice to other Fedora users: Get the newest xcb-util-wm packages and 'make clean all' in bspwm.

On Ubuntu, xcb-util-wm is a source package which is used to build libxcb-ewmh-dev and libxcb-ewmh2.

It looks like my system already has version 0.3.9 of the above installed, as suggested in the above quotation:

Package: libxcb-ewmh2
Source: xcb-util-wm
Version: 0.3.9-2

Package: libxcb-ewmh-dev
Source: xcb-util-wm
Version: 0.3.9-2

Here are some other xcb package versions:

Package: libxcb-keysyms1-dev
Source: xcb-util-keysyms
Version: 0.3.9-1

Package: libxcb-keysyms1
Source: xcb-util-keysyms
Version: 0.3.9-1

Package: libx11-xcb-dev
Source: libx11
Version: 2:1.5.0-1ubuntu1

Package: libxcb1
Source: libxcb
Version: 1.8.1-2ubuntu2

Package: libxcb-util0-dev
Source: xcb-util
Version: 0.3.8-2build1

@andornaut
Copy link
Author

This issue only occurs when I have a second monitor connected. If I disconnect my second monitor and run startx, then bspwm works as expected.

@andornaut
Copy link
Author

This is the first commit with which I experience this issue: 80caab4

I've reverted to this commit, which works as expected: 1ef4d4f

@baskerville
Copy link
Owner

Can you make it crash by plugging your secondary monitor?

If so, you could run this in a virtual terminal (while bspwm is running):

su -c 'echo 0 > /proc/sys/kernel/yama/ptrace_scope'
gdb bspwm $(pgrep -x bspwm)
set logging on
c

Then go back to X and plug the second monitor.

Switch back to the virtual terminal holding gdb and issue:

bt full
q
y

@andornaut
Copy link
Author

Can you make it crash by plugging your secondary monitor?

Nope. The second monitor isn't initialized though.

I can start Xorg with only exec xterm in .xinitrc then run gdb on bspwm, though:

Starting program: /usr/local/bin/bspwm 
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
Program received signal SIGSEGV, Segmentation fault.
0x0000000000413f63 in ?? ()
#0  0x0000000000413f63 in ?? ()
No symbol table info available.
#1  0x000000090061a550 in ?? ()
No symbol table info available.
#2  0x00007fff00000000 in ?? ()
No symbol table info available.
#3  0x0000000000619280 in ?? ()
No symbol table info available.
#4  0x000001f2000001f1 in ?? ()
No symbol table info available.
#5  0x31706f746b736544 in ?? ()
No symbol table info available.
#6  0x00007fffffff9b00 in ?? ()
No symbol table info available.
#7  0x0000000000000005 in ?? ()
No symbol table info available.
#8  0x00007fffffff9b20 in ?? ()
No symbol table info available.
#9  0x00007fffffff9af0 in ?? ()
No symbol table info available.
#10 0x0000000000000005 in ?? ()
No symbol table info available.
#11 0x00007fffffff9b40 in ?? ()
No symbol table info available.
#12 0x0000000000000000 in ?? ()
No symbol table info available.
A debugging session is active.
    Inferior 1 [process 12735] will be killed.
Quit anyway? (y or n) 

Here's the process I followed:

git clone https://github.com/baskerville/bspwm.git
cd bspwm
make debug
sudo make install
# startx with only exec xterm in .xinitrc
# In the xterm
gdb
set logging on
target exec /usr/local/bin/bspwm
run
# Segfaults here
bt full
q
y

@baskerville
Copy link
Owner

This: target exec /usr/local/bin/bspwm doesn't load the symbols table, use file /usr/local/bin/bspwm instead.

@andornaut
Copy link
Author

use file /usr/local/bin/bspwm instead.

Done. Here's the gdb.txt:

Starting program: /usr/local/bin/bspwm 
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
Program received signal SIGSEGV, Segmentation fault.
0x0000000000413f63 in ewmh_update_desktop_names () at ewmh.c:80
80              for (j = 0; d->name[j] != '\0' && (i + j) < sizeof(names); j++)
#0  0x0000000000413f63 in ewmh_update_desktop_names () at ewmh.c:80
        d = 0x1f2000001f1
        m = 0x619280
        names = "Desktop1\000\235\377\377\377\177\000\000\005\000\000\000\000\000\000\000\340\235\377\377\377\177\000\000\260\235\377\377\377\177\000\000\005\000\000\000\000\000\000\000\000\236\377\377\377\177", '\000' , "/\\\214\367\377\177\000\000\022\000\a\000\003\002\000\000\227\001\000\000\006\000\000\000 \000\000\000\001", '\000' , "\260\235\377\377\377\177\000\000\225\214\336\367\377\177\000\000\001", '\000' , "\b\235\377\377\377\177\000\000\000\000\000\000\000\000\000\000\350A\255\367\377\177\000\000\000\000\000\000\000\000\000\000\240\235\377\377\377\177\000\000\000\000\000\000\000\000\000\000\350A\255\367\377\177\000\000\000\000\000\000\000\000\000\000"...
        i = 9
        j = 0
        names_len = 32767
#1  0x00000000004061f4 in add_desktop (m=0x621da0, d=0x621d00) at desktop.c:120
No locals.
#2  0x0000000000405bd8 in import_monitors () at monitor.c:300
        sres = 0x621910
        m = 0x621da0
        mm = 0x619280
        num = 2
        len = 6
        outputs = 0x621940
        cookies = 0x7fffffff9de0
        gpo = 0x620390
#3  0x00000000004042d3 in setup () at bspwm.c:224
        mask = 2048
        values = {64}
        net_atoms = {404, 395, 410, 407, 368, 405, 367, 372, 375, 378, 442, 
          387, 429, 428, 438, 434, 432, 430}
        qep = 0x6203f0
        ifo = 0x7ffff78b9b40
#4  0x000000000040396d in main (argc=1, argv=0x7fffffffe338) at bspwm.c:73
        descriptors = {__fds_bits = {0 }}
        socket_path = '\000' 
        fifo_path = 0x0
        sock_fd = 0
        ret_fd = 0
        dpy_fd = 0
        sel = 0
        n = 0
        sock_address = {sun_family = 0, sun_path = '\000' }
        rsp_len = 0
        msg = '\000' 
        rsp = '\000' 
        event = 0x0
        opt = -1 '\377'
        sp = 0x0
A debugging session is active.
    Inferior 1 [process 17165] will be killed.
Quit anyway? (y or n)

@baskerville
Copy link
Owner

Should be fixed by 6ae7601.

@andornaut
Copy link
Author

Should be fixed by 6ae7601.

Confirmed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants