winit icon indicating copy to clipboard operation
winit copied to clipboard

core dump in Xorg session

Open Frigyes06 opened this issue 1 year ago • 4 comments

Description

On GNOME Xorg with Nvidia viideo card, appliccation using winit fails to launch:

2024-03-26 10:43:46 ERROR [/build/universal-android-debloater/src/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/mod.rs:713] X11 error: XError {
    description: "BadMatch (invalid parameter attributes)",
    error_code: 8,
    request_code: 149,
    minor_code: 4,
}

winit 0.28.7 works fine

OS and window mananger

Arch Linux with GNOME Xorg session

Winit version

0.29.15

Frigyes06 avatar Mar 30 '24 23:03 Frigyes06

Can you run the example application under xtrace and paste the logs in a Gist?

notgull avatar Mar 31 '24 00:03 notgull

Another possibility: You could provide the output of xdpyinfo -queryExtensions | grep opcode. That's less useful than xtrace, but would provide some hint at which request this is.

psychon avatar May 01 '24 08:05 psychon

I'm getting the same when I try to run the examples in (lyon)[https://github.com/nical/lyon], so perhaps my debug info can help.

❱ uname -a

Linux positron 6.8.0-76060800daily20240311-generic #202403110203~1715181801~22.04~aba43ee SMP PREEMPT_DYNAMIC Wed M x86_64 x86_64 x86_64 GNU/Linux

❱ lsb_release -a
No LSB modules are available.
Distributor ID:	Pop
Description:	Pop!_OS 22.04 LTS
Release:	22.04
Codename:	jammy

❱ echo $DESKTOP_SESSION
xmonad

# NB: xmonad ⇒ X11

❱ nvidia-smi                                                                                 <<<
Fri Jun 21 16:05:37 2024       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.67                 Driver Version: 550.67         CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1050 ...    Off |   00000000:01:00.0 Off |                  N/A |
| N/A   52C    P0             N/A / ERR!  |    1490MiB /   4096MiB |      8%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A      4856      G   /usr/lib/xorg/Xorg                            862MiB |
|    0   N/A  N/A      5069      G   picom                                          53MiB |
|    0   N/A  N/A      5250      G   /usr/lib/insync/insync                          1MiB |
⋮
|    0   N/A  N/A     65630      G   ...,WinRetrieveSuggestionsOnlyOnDemand        103MiB |
+-----------------------------------------------------------------------------------------+


❱ xdpyinfo -queryExtensions | grep opcode
    BIG-REQUESTS  (opcode: 133)
    Composite  (opcode: 142)
    DAMAGE  (opcode: 143, base event: 91, base error: 152)
    DOUBLE-BUFFER  (opcode: 145, base error: 153)
    DPMS  (opcode: 147)
    DRI2  (opcode: 155, base event: 119)
    DRI3  (opcode: 149)
    GLX  (opcode: 152, base event: 95, base error: 158)
    Generic Event Extension  (opcode: 128)
    MIT-SCREEN-SAVER  (opcode: 144, base event: 92)
    MIT-SHM  (opcode: 130, base event: 65, base error: 128)
    NV-CONTROL  (opcode: 157, base event: 121)
    NV-GLX  (opcode: 156)
    Present  (opcode: 148)
    RANDR  (opcode: 140, base event: 89, base error: 147)
    RECORD  (opcode: 146, base error: 154)
    RENDER  (opcode: 139, base error: 142)
    SECURITY  (opcode: 137, base event: 86, base error: 138)
    SHAPE  (opcode: 129, base event: 64)
    SYNC  (opcode: 134, base event: 83, base error: 134)
    X-Resource  (opcode: 150)
    XC-MISC  (opcode: 136)
    XFIXES  (opcode: 138, base event: 87, base error: 140)
    XFree86-DGA  (opcode: 154, base event: 112, base error: 179)
    XFree86-VidModeExtension  (opcode: 153, base error: 172)
    XINERAMA  (opcode: 141)
    XInputExtension  (opcode: 131, base event: 66, base error: 129)
    XKEYBOARD  (opcode: 135, base event: 85, base error: 137)
    XTEST  (opcode: 132)
    XVideo  (opcode: 151, base event: 93, base error: 155)


❱ xdpyinfo -queryExtensions | grep opcode | grep 149
    DRI3  (opcode: 149)

I've attached the xtrace info. (It's too big to paste inline.)

err.log

timtro avatar Jun 21 '24 20:06 timtro

Random ramblings There are 31 X11 errors. Most of them are DRI3-related. There is one `BadWindow` error, 21 `BadMatch` errors, and 9 errors that xtrace could not identify.

The last one is for major opcode 134 and has error code 136. According to the -queryExtensions output, this must be SYNC+2 since SYNC has base error: 134. According to https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/blob/master/src/sync.xml there is no <error number="2>. Weird...

These errors are for request SYNC-DestroyFence. Since this has only a Fence argument, this is perhaps some BadFence error? Dunno.

A random one of these is:

000:<:017e:  8: SYNC-Request(134,17): DestroyFence fid=0x03800009

There is no other occurrence of 0x03800009 in the output of xtrace. So.. yeah, no such fence was ever created?!

Anyway, this issue is about BadMatch errors. Most of them are from DRI3-Open failing, e.g.:

003:<:0003: 12: DRI3-Request(149,1): Open drawable=0x00000218 provider=0
003:>:0003:Error 8=Match: major=149, minor=1, bad=0x00000218, seq=0003

There is also a DRI3-FenceFromFd failing:

000:<:0158: 16: DRI3-Request(149,4): FenceFromFD drawable=0x03800008 fence=58720265 initially_triggered=false(0x00)
[...]
000:>:0158:Error 8=Match: major=149, minor=4, bad=0x03800008, seq=0158

(Side note: Ahhh, the above fence=58... tells me that (for whatever reason) fences are not printed in hex, but in decimal. That's why I didn't find the fence above that was failing to destroy. It is actually this request. It cannot be destroyed since the request that created it already failed.)

According to the above ramblings, all the BadMatch errors either come from DRI3-Open or DRI3-FenceFromFD. According to the original post, we have minor_code=4. https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/blob/master/src/dri3.xml says that this is FenceFromFD. No idea why the previous BadMatches for DRI3-Open do not appear.

https://cgit.freedesktop.org/xorg/proto/dri3proto/tree/dri3proto.txt does not describe when DRI3-Open or DRI3-FenceFromFD fail. :-(

Sorry, I do not know details about DRI.

(Also, the xtrace output contains seven separate X11 connections. I do not know which is why. The first connection appears 886 times, the second and third connections only 61 and 75 times, respectively. The other four connections each only appear 8 times and are thus basically unused. Connections number 3, 4, 5, 6 all appear right next to each in the middle of the xtrace output and each one only gets to a failing DRI3-Open request and does not do anything else. Connections 0, 1, 2 all use the NV-GLX extension, which I never heard about and which sounds NVidia-specific)

psychon avatar Jun 22 '24 11:06 psychon