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

DesktopConfiguration per-monitor segmentation fault in certain repeatable conditions #19

Closed
NsCDE opened this issue Jan 13, 2020 · 8 comments
Assignees
Labels
type:bug Something's broken!
Milestone

Comments

@NsCDE
Copy link
Contributor

NsCDE commented Jan 13, 2020

Hello again,

Version: ta/desktops

If secondary monitor is plugged off and I log in via XDM, plug new monitor and then issue the command:

xrandr --output eDP1 --mode 1920x1080 --primary --output DP1 --mode 2560x1440 --right-of eDP1 --noprimary

fvwm3 crashes (trace on the bottom).

When it doesn't crashes:

  • when DesktopConfiguration is "global" and than changed to per-monitor via FvwmConsole after startup prior or after xrandr command described above.
  • when I exit/restart from fvwm3 to bare xterm and start fvwm3 from command line (prior or after xrandr)
  • If second monitor is already on before logging in

Probably not related to this issue, but may be of interest to you:
I was reading your "Multiple Pages (3x3) and RandR is confusing and broken" and trying to introduce myself to new per-monitor mode to better understand problematic and maybe propose something when I discovered this. I have also found that "FvwmPager * 3" is very confused and changes DesktopSize (pages) from configured 2x2 to 3x3 on the fly, but that is probably already known to you ... or maybe currently/temporary hardcoded for testing? Interestingly, "local" pager, that is, FvwmPager which shows only one desk retains 2x2 DesktopSize.

Trace:

gdb /opt/fvwm3/bin/fvwm3 /var/coredumps/core-prokopije-fvwm3-7011-11-22687

Reading symbols from /opt/fvwm3/bin/fvwm3...done.
[New LWP 22687]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/opt/fvwm3/bin/fvwm3 -f /opt/NsCDE/config/NsCDE-Main.conf'.
Program terminated with signal 11, Segmentation fault.
#0 0x000000000047c502 in EWMH_SetDesktopNames (m=0x2108990) at ewmh_names.c:285
285 ewmh_names.c: No such file or directory.

[...]

(gdb) bt
#0 0x000000000047c502 in EWMH_SetDesktopNames (m=0x2108990) at ewmh_names.c:285
#1 0x0000000000428e68 in HandleRRScreenChangeNotify (e=e@entry=0x7fff819dacf0) at events.c:1806
#2 0x000000000042b7c0 in dispatch_event (e=e@entry=0x7fff819dacf0) at events.c:4185
#3 0x000000000042c49d in HandleEvents () at events.c:4294
#4 0x000000000040aeaa in main (argc=, argv=0x7fff819db568) at fvwm3.c:2594

Desktop names are set during login. I'm using 4 desks x 4 pages (2x2) == 16.

@ThomasAdam
Copy link
Member

Hi,

Thanks again -- you're getting good at filing these reports!

Just to confirm when this crash happens, had you changed DesktopConfiguration at all?

Can you have another look at your corefile, but this time do:

(gdb) bt full
(gdb) f 0
(gdb) p m->Desktops
(gdb) p m->flags

I'm presuming that m->Desktops is NULL which would explain the crash, since m looks like a valid pointer.

With respect to the changing of DesktopSize, yes, I know about this. I need to fix it, but I suspect I'll wait until #17 is looked at.

@ThomasAdam ThomasAdam added the type:bug Something's broken! label Jan 13, 2020
@ThomasAdam ThomasAdam added this to the 3.0 milestone Jan 13, 2020
@ThomasAdam ThomasAdam self-assigned this Jan 13, 2020
@NsCDE
Copy link
Contributor Author

NsCDE commented Jan 13, 2020

I have to. I'm using FVWM from 2006 or 2007 or so! :)

DesktopConfiguration was not present at all. I have logged on the console and added it in the configuration, then get back at XDM login screen, logged in, plugged monitor in and only then, when I issue xrandr command in X terminal, the same second, I'm logged out and core dump is created. If I put "global" instead of "per-monitor" it doesn't dies in the same sequence of steps, or if I change initial "global" to "per-monitor" later.

Here is the trace. May be DesktopConfiguration needs to be set after DesktopSize and desk names? Will try that later if you want.

(gdb) bt full
#0 0x000000000047c502 in EWMH_SetDesktopNames (m=0x2108990) at ewmh_names.c:285
nbr = 0
len = 0
i =
j = 0
d =
s =
names =
val =
#1 0x0000000000428e68 in HandleRRScreenChangeNotify (e=e@entry=0x7fff819dacf0) at events.c:1806
t =
mcur = 0x1f6ee40
m = 0x2108990
#2 0x000000000042b7c0 in dispatch_event (e=e@entry=0x7fff819dacf0) at events.c:4185
w = 372
fw = 0x0
event_group =
#3 0x000000000042c49d in HandleEvents () at events.c:4294
ev = {type = 89, xany = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, window = 372}, xkey = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, window = 372,
root = 372, subwindow = 1836334025, time = 1836378424, x = 65535, y = 1, x_root = 4480, y_root = 1440, state = 788, keycode = 253, same_screen = 1}, xbutton = {type = 89, serial = 43597,
send_event = 0, display = 0x1f62130, window = 372, root = 372, subwindow = 1836334025, time = 1836378424, x = 65535, y = 1, x_root = 4480, y_root = 1440, state = 788, button = 253,
same_screen = 1}, xmotion = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, window = 372, root = 372, subwindow = 1836334025, time = 1836378424, x = 65535, y = 1,
x_root = 4480, y_root = 1440, state = 788, is_hint = -3 '\375', same_screen = 1}, xcrossing = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, window = 372, root = 372,
subwindow = 1836334025, time = 1836378424, x = 65535, y = 1, x_root = 4480, y_root = 1440, mode = 788, detail = 253, same_screen = 1, focus = 0, state = 0}, xfocus = {type = 89,
serial = 43597, send_event = 0, display = 0x1f62130, window = 372, mode = 372, detail = 0}, xexpose = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, window = 372, x = 372,
y = 0, width = 1836334025, height = 0, count = 1836378424}, xgraphicsexpose = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, drawable = 372, x = 372, y = 0,
width = 1836334025, height = 0, count = 1836378424, major_code = 0, minor_code = 65535}, xnoexpose = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, drawable = 372,
major_code = 372, minor_code = 0}, xvisibility = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, window = 372, state = 372}, xcreatewindow = {type = 89, serial = 43597,
send_event = 0, display = 0x1f62130, parent = 372, window = 372, x = 1836334025, y = 0, width = 1836378424, height = 0, border_width = 65535, override_redirect = 1}, xdestroywindow = {
type = 89, serial = 43597, send_event = 0, display = 0x1f62130, event = 372, window = 372}, xunmap = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, event = 372, window = 372,
from_configure = 1836334025}, xmap = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, event = 372, window = 372, override_redirect = 1836334025}, xmaprequest = {type = 89,
serial = 43597, send_event = 0, display = 0x1f62130, parent = 372, window = 372}, xreparent = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, event = 372, window = 372,
parent = 1836334025, x = 1836378424, y = 0, override_redirect = 65535}, xconfigure = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, event = 372, window = 372, x = 1836334025,
y = 0, width = 1836378424, height = 0, border_width = 65535, above = 6184752910720, override_redirect = 788}, xgravity = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130,
event = 372, window = 372, x = 1836334025, y = 0}, xresizerequest = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, window = 372, width = 372, height = 0},
xconfigurerequest = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, parent = 372, window = 372, x = 1836334025, y = 0, width = 1836378424, height = 0, border_width = 65535,
above = 6184752910720, detail = 788, value_mask = 1}, xcirculate = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, event = 372, window = 372, place = 1836334025},
xcirculaterequest = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, parent = 372, window = 372, place = 1836334025}, xproperty = {type = 89, serial = 43597, send_event = 0,
display = 0x1f62130, window = 372, atom = 372, time = 1836334025, state = 1836378424}, xselectionclear = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, window = 372,
selection = 372, time = 1836334025}, xselectionrequest = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, owner = 372, requestor = 372, selection = 1836334025,
target = 1836378424, property = 4295032831, time = 6184752910720}, xselection = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, requestor = 372, selection = 372,
target = 1836334025, property = 1836378424, time = 4295032831}, xcolormap = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, window = 372, colormap = 372, new = 1836334025,
state = 0}, xclient = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, window = 372, message_type = 372, format = 1836334025, data = {
b = "8\351tm\000\000\000\000\377\377\000\000\001\000\000\000\200\021\000", s = {-5832, 28020, 0, 0, -1, 0, 1, 0, 4480, 0}, l = {1836378424, 4295032831, 6184752910720, 1086626726676, 1}}},
xmapping = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, window = 372, request = 372, first_keycode = 0, count = 1836334025}, xerror = {type = 89, display = 0xaa4d,
resourceid = 0, serial = 32907568, error_code = 116 't', request_code = 1 '\001', minor_code = 0 '\000'}, xkeymap = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130,
window = 372, key_vector = "t\001\000\000\000\000\000\000\311;tm\000\000\000\000\070\351tm\000\000\000\000\377\377\000\000\001\000\000"}, xgeneric = {type = 89, serial = 43597, send_event = 0,
display = 0x1f62130, extension = 372, evtype = 0}, xcookie = {type = 89, serial = 43597, send_event = 0, display = 0x1f62130, extension = 372, evtype = 0, cookie = 372, data = 0x6d743bc9},
pad = {140106128162905, 43597, 0, 32907568, 372, 372, 1836334025, 1836378424, 4295032831, 6184752910720, 1086626726676, 1, 0 <repeats 11 times>, 13200}}
#4 0x000000000040aeaa in main (argc=, argv=0x7fff819db568) at fvwm3.c:2594
valuemask = 8202
attributes = {background_pixmap = 0, background_pixel = 12500670, border_pixmap = 4706915001143676750, border_pixel = 0, bit_gravity = 543516788, win_gravity = 1702131813,
backing_store = 1881175150, backing_planes = 2340009372658529396, backing_pixel = 8462080219605852524, save_under = 2036428064, event_mask = 2097155, do_not_propagate_mask = 8315168218635509861,
override_redirect = 1, colormap = 34, cursor = 8388612}
---Type to continue, or q to quit---
i =
len =
display_string =
do_force_single_screen =
single_screen_num = -1
replace_wm =
visualClass =
visualId = -1
colorLimitop = {color_limit = -1, strict = -1, allocate = -1, not_dynamic = -1, use_named_table = -1}
exc =
ecc = {type = EXCT_INIT, x = {etrigger = 0x4a521f, elast = 0x4a521f}, w = {fw = 0x4a2b98, w = 4870687, wcontext = 8}, m = {module = 0x4a2bd0}}
m =
(gdb)
(gdb) f 0
#0 0x000000000047c502 in EWMH_SetDesktopNames (m=0x2108990) at ewmh_names.c:285
285 in ewmh_names.c
(gdb) print m->Desktops
$1 = (DesktopsInfo *) 0x0
(gdb) print m->flags
$2 = 1

@NsCDE
Copy link
Contributor Author

NsCDE commented Jan 14, 2020

FYI, I have tried setting DesktopConfiguration after desktop names. It doesn't help.

I was able to reproduce this on another system: Fedora 31 in KVM virtual environment. Multihead support in spice/kvm works nice with remote-viewer and now I can debug without logging in/out with test users on hardware. Much faster and flexible.

Virtual-0 and Virtual-1 are behaving exactly the same as my physical eDP1 and DP1. Even core dump is equally nice. :)

ThomasAdam added a commit that referenced this issue Jan 21, 2020
When a given output changes size, or is disabled, ensure FVWM is better
informed so that it can adjust its view of which outputs are available
and what their sizes are.

FVWM uses rectangle calculations to determine if a window should receive
focus.  When monitors come and go, FVWM needs to reinstate its view of
these outputs and their rectangles, based on the screen size at the
time.

It's more complicated with `DesktopConfiguration per-monitor` due to the
width/height of the screen being different from one another,
potentially.

This change is big, and is littered with debug.

Goes a long way to fixing Github Issue #16, #19.
ThomasAdam added a commit that referenced this issue Jan 28, 2020
When a given output changes size, or is disabled, ensure FVWM is better
informed so that it can adjust its view of which outputs are available
and what their sizes are.

FVWM uses rectangle calculations to determine if a window should receive
focus.  When monitors come and go, FVWM needs to reinstate its view of
these outputs and their rectangles, based on the screen size at the
time.

It's more complicated with `DesktopConfiguration per-monitor` due to the
width/height of the screen being different from one another,
potentially.

This change is big, and is littered with debug.

Goes a long way to fixing Github Issue #16, #19.
@ThomasAdam
Copy link
Member

@NsCDE -- do you have any instructions on how to set up KVM/Spice? I'm using both (Debian host & Debian VM), but despite having Spice in use, my VM only sees one monitor. I can see under the 'Display' menu for the VM that I could select up to four monitors, but monitors 2 to 4 are all greyed out, and xrandr(1) from within the VM only shows on Virtual monitor.

Any thoughts? According to the documentation, this should Just Work, but it doesn't seem to work for me.

@NsCDE
Copy link
Contributor Author

NsCDE commented Mar 4, 2020

Hi Thomas

Check this 3 things:

  1. Yes, I was having trouble too. My best guess is that XML for virtual machine defines only one head.

Try virsh edit VMNAME, find video section and check number of heads. By default, virt-manager creates this with heads='1' which is then a problem.

<video>
  <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='4' primary='yes'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
  1. Make sure you use qxl Xorg and kernel driver inside guest VM.

  2. Make sure spice-vdagentd is started as a service when you log in.

3a. Make sure spice-vdagent is started manually by you, or from some login script after you log in. This connects RandR from guest with KVM infrastructure.

EDIT:
And make sure you shutdown virtual machine after changing XML, reboot is not enough, since OS reboot is not virtual machine reboot.

@ThomasAdam
Copy link
Member

Hmm -- thanks. Still not working -- I can see four displays now (thanks to editing the XML), but only the first virtual monitor is active (remote-viewer spice://localhost:5900). The other three monitors are listed but inactive. I can't seem to enable them via xrandr(1) in the guest.

Looking at the XServer logs, the guest is using QXL. spice-vdagent is running as a service on the guest. There's no errors or anything in the logs to suggest a problem.

@NsCDE
Copy link
Contributor Author

NsCDE commented Mar 4, 2020

Inactive monitors on remote-viewer menu can indicate that either spice-vdagentd or spice-vdagent is not running.
Here is the situation on my FVWM3 test VM:

tmangrow    3155       1  0 16:52 ?        00:00:00 spice-vdagent
root        3254       1  0 16:53 ?        00:00:00 /usr/sbin/spice-vdagentd

Daemon spice-vdagentd as a root service, spice-vdagent as graphically logged in user service.

Spice vdagent package version in Fedora 31 VM is 0.19.0, qemu-kvm on the CentOS 7 host is 1.5.3 ... just in case, but this should not make any difference.

This are my spice and qxl relevant parts of the XML on the KVM host:


    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>
    <graphics type='spice' port='5969' autoport='no' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='4' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>

Xorg.0.log on guest:

[root@testbox10 ~]# grep qxl /var/log/Xorg.0.log | grep Virtual
[     9.890] (II) qxl(0): Output Virtual-0 has no monitor section
[     9.890] (II) qxl(0): Output Virtual-1 has no monitor section
[     9.890] (II) qxl(0): Output Virtual-2 has no monitor section
[     9.890] (II) qxl(0): Output Virtual-3 has no monitor section
[     9.890] (II) qxl(0): EDID for output Virtual-0
[     9.890] (II) qxl(0): Printing probed modes for output Virtual-0
[     9.891] (II) qxl(0): EDID for output Virtual-1
[     9.891] (II) qxl(0): EDID for output Virtual-2
[     9.891] (II) qxl(0): EDID for output Virtual-3
[     9.891] (II) qxl(0): Output Virtual-0 connected
[     9.891] (II) qxl(0): Output Virtual-1 disconnected
[     9.891] (II) qxl(0): Output Virtual-2 disconnected
[     9.891] (II) qxl(0): Output Virtual-3 disconnected
[     9.891] (II) qxl(0): Output Virtual-0 using initial mode 1024x768 +0+0

Hope this helps.

@ThomasAdam
Copy link
Member

Perfect. Thanks, @NsCDE this is working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something's broken!
Projects
Status: Done
Development

No branches or pull requests

2 participants