Xpra-org / xpra

Persistent remote applications for X11; screen sharing for X11, MacOS and MSWindows.
https://xpra.org/
GNU General Public License v2.0
1.99k stars 169 forks source link

OpenGL Acceleration failure: WinError 6 #4393

Closed themoonisacheese closed 3 weeks ago

themoonisacheese commented 1 month ago

Describe the bug When using xpra (client) 6.2 on windows, connecting to a server succeeds, but shows a notification: image

"Descripteur invalide" =>"Invalid Descriptor" in french This did not happen under 5.0.7, the previous version i was using.

To Reproduce Steps to reproduce the behavior:

  1. on server: xpra start --bind-tcp=0.0.0.0:5900 --start=.local/bin/kitty
  2. on client, C:\Users\user\Desktop\Xpra-x86_64_6.2.0-r0\Xpra.exe attach tcp://user@server:5900/
  3. remote terminal appears, notification shows.

System Information (please complete the following information):

Additional context opening xpra.exe, going to the toolbox and clicking "OpenGL" yields this error: image but clicking the same button in 5.0.7 correctly shows the openGL test window.

The graphics on this PC is pre-Iris intel UHD integrated graphics, on an i7-8665U.

I remain available for additionnal logs.

totaam commented 1 month ago

I'm pretty sure that we have a ticket somewhere with this error. @themoonisacheese: please paste the text, not a picture of text.

Do you get the same error when using Xpra_cmd.exe instead of Xpra.exe?

themoonisacheese commented 1 month ago

I am unable to paste the text; this is a windows error message, the text is not selectable.

Apologies if this is a duplicate, I did search for this issue and did not find a similar ticket.

using Xpra_cmd.exe does not show the same notification, however it does exhibit a shared behavior: while xpra is connecting, the window that shows where in the init process it is is completely white. This also didn't happen in 5.0.7: image

logs from launching with Xpra_cmd.exe:

2024-10-16 09:26:58,129 Xpra GTK3 client version 6.2.0-r0
2024-10-16 09:26:58,306  running on Microsoft Windows Microsoft Windows 10 Pro
2024-10-16 09:26:58,311  cpython 3.11
2024-10-16 09:27:01,204 GStreamer version 1.24.8
2024-10-16 09:27:01,214 created named pipe 'Xpra\8484'
2024-10-16 09:27:01,350 Error setting up the pipeline:
2024-10-16 09:27:01,351  gst_parse_error: could not link decoder to sink (3)
2024-10-16 09:27:01,357  GStreamer pipeline for:
2024-10-16 09:27:01,357   appsrc name=src emit-signals=1 block=0 is-live=1 do-timestamp=1 stream-type=0 format=2 caps=video/x-h264,width=128,height=128,profile=(string)main,stream-format=(string)byte-stream,alignment=(string)au ! \
2024-10-16 09:27:01,358   d3d11h264dec name=decoder ! \
2024-10-16 09:27:01,358   appsink name=sink emit-signals=1 max-buffers=10 drop=False sync=False async=True qos=False caps=video/x-raw,width=128,height=128,format=(string)I420
2024-10-16 09:27:01,361 Error creating context h264 128x128 YUV420P
2024-10-16 09:27:01,362 gstreamer: h264 decoding failed: failed to setup gstreamer pipeline
2024-10-16 09:27:01,368 keyboard layout 'United States - English' : 'us' (0x409)
2024-10-16 09:27:01,829 OpenGL 4.6 enabled on 'Intel(R) UHD Graphics 620'
2024-10-16 09:27:01,831  using native win32 backend
2024-10-16 09:27:01,835  zerocopy is available
2024-10-16 09:27:01,930  keyboard settings: layout=us
2024-10-16 09:27:01,936  desktop size is 3840x1200:
2024-10-16 09:27:01,940   Default (1016x317 mm - DPI: 96x96) workarea: 3840x1160
2024-10-16 09:27:01,940     Dell Inc. DELL P2422H 1920x1080 at    0x0    (527x296 mm - DPI: 93x93) workarea: 1920x1040
2024-10-16 09:27:01,941     X2485            1920x1200 at 1920x0    (518x324 mm - DPI: 94x94) workarea: 1920x1160 at 1920x0
2024-10-16 09:27:02,028 enabled remote logging
2024-10-16 09:27:02,032 Xpra X11 seamless server version 6.2
2024-10-16 09:27:02,050 Attached to xpra server at tcp://user@server:5900/
2024-10-16 09:27:02,050  (press Control-C to detach)

2024-10-16 09:27:02,372 running, 1 windows
2024-10-16 09:27:03,270 audio playback using 'opus' audio codec
totaam commented 1 month ago

I am unable to paste the text; this is a windows error message, the text is not selectable.

Ah, right. That's unfortunate: the opengl test module encounters an error and the error handler has a bug (now fixed) so we can't see what it is and we get this generic error window instead. I will make 6.3-beta builds so you can test again properly.

Apologies if this is a duplicate, I did search for this issue and did not find a similar ticket.

No worries. I'm sure it exists somewhere, but even I couldn't find it!

the window that shows where in the init process it is is completely white

That's odd! Seems similar to the opengl WinError 6 to me: looks like the subprocesses are having problems communicating over pipes. Is there anything special about this PC?

themoonisacheese commented 1 month ago

I will make 6.3-beta builds so you can test again properly.

sounds good

Is there anything special about this PC?

Probably not beyond that it's old? It's a work machine (hence why i'm using the portable zip instead of installing xpra), so it's managed by AD. We use a popular corporate AV suite (i can't name it but it's in the top 10). I'm not local admin on it.

My graphics driver is up to date (as much as it could be for a 7 year old chip anyway) and so is the rest of the PC.

totaam commented 1 month ago

Done: I've made 6.2.0-r3 builds for MS Windows with the fix above: https://xpra.org/beta/windows/

This should tell us more about the OpenGL error.

themoonisacheese commented 1 month ago

well i'll give you that the windows error message no longer appears when testing opengl, however nothing else replaces it. i couldn't find a log file in the extracted dir. is there a specific place for client logs?

totaam commented 1 month ago

Ah, maybe run xpra_cmd.exe opengl -d opengl

themoonisacheese commented 1 month ago

openly is not a valid subcommand.

totaam commented 1 month ago

It was opengl (edited)

I had typed the message on my phone, helpfully autocorrected to openly!

themoonisacheese commented 1 month ago

5.0-opengl.log 6.2-opengl.log

here are logs for the 2 versions

rcoacci commented 1 month ago

I'm seeing the same issue, in different computers with different video cards, one Intel notebook and a Nvidia workstation. I noticed that if I start from the command line with Xpra_cmd.exe everything works, and I even have OpenGL enabled. However if I start from Xpra-Laucher or Xpra.exe either from command line of from the menu, I get the Invalid Descriptor error an OpenGL is disabled.

It seems the problem is on the GUI side. Perhaps you have to initialize OpenGL earlier when running the GUI? I can provide you with xpra_cmd opengl -d opengl but since it's using xpra_cmd I suspect it won't help.

rcoacci commented 1 month ago

I just tried Xpra-x86_64_6.3-r36793 from https://xpra.org/beta/windows/, and I can't even get a GUI (Xpra.exe and Xpra-Launcher doesn't show up), with a bunch of Gtk errors. Surprinsingly Xpra_cmd works with a bunch of gtk errors, but I can attach to the remote session.

It seems to be missing the libpixbufloader-png.dll. I downloaded the Xpra-x86_64_6.3-r36793.zip file.

totaam commented 1 month ago

@rcoacci 6.2 has just been released so 6.3 is an early beta, undergoing some packaging changes for #4050 and #4394 - these should be ironed out soon enough.

rcoacci commented 1 month ago

@rcoacci 6.2 has just been released so 6.3 is an early beta, undergoing some packaging changes for #4050 and #4394 - these should be ironed out soon enough.

Sure, I just tried 6.3 because of the comments above asking the other reporter to try it. If there is anything else I can do to help debug the OpenGL issue let me know.

totaam commented 3 weeks ago

Sorry it has taken so long.

For reasons that I don't fully understand yet, the bare metal system that I use for testing MS Windows builds was failing, but without popping up the dialog, so I had to dig up the message in the log file:

2024-10-29 15:11:57,726 OpenGL probe command returned 0 for command=['C:\\Program Files\\Xpra\\Xpra.exe', 'opengl', '-d', 'opengl']
2024-10-29 15:11:57,726 probe took 3077ms
2024-10-29 15:11:57,726 parsed OpenGL properties={'GLU': '1.2.2.0 Microsoft Corporation', 'accelerate': '3.1.7', 'array-handlers': '()', 'backend': 'win32', 'core-profile': False, 'display_mode': 'DOUBLE', 'flags': '()', 'max-viewport-dims': (16384, 16384), 'module': 'native', 'opengl': '4.6', 'platform': 'win32', 'pyopengl': '3.1.7', 'renderer': 'AMD Radeon(TM) RX Vega 11 Graphics', 'safe': True, 'shading-language-version': '4.60', 'success': True, 'texture-size-limit': 16384, 'vendor': 'ATI Technologies Inc.', 'zerocopy': True}
2024-10-29 15:11:57,726 probe_message()='success'
E:/xpra/xpra/client/mixins/audio.py:129: ResourceWarning: unclosed file <_io.TextIOWrapper name='nul' mode='w' encoding='cp1252'>
  self.audio_properties = query_audio()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
2024-10-29 15:11:58,306 GStreamer version 1.24.8
2024-10-29 15:11:58,321 created named pipe 'Xpra\8940'
2024-10-29 15:11:58,384 keyboard layout 'United Kingdom' : 'gb' (0x809)
2024-10-29 15:11:58,399 init_opengl(probe-success)
2024-10-29 15:11:58,399 init_opengl: enable_option=probe-success
2024-10-29 15:11:58,399 init_opengl: going to import xpra.opengl
2024-10-29 15:11:58,399 debug enabled for ['xpra.opengl.window', 'opengl', 'paint']
2024-10-29 15:11:58,399 opengl_module=<module 'OpenGL' from 'C:\\Program Files\\Xpra\\lib\\library.zip\\OpenGL\\__init__.py'>
2024-10-29 15:11:58,399 get_opengl_module_names(probe-success)
2024-10-29 15:11:58,399 get_gl_client_window_module(probe-success) module names=('native', 'glarea')
2024-10-29 15:11:58,399 debug enabled for ['xpra.client.gtk3.opengl.client_window', 'opengl', 'window']
2024-10-29 15:11:58,415 debug enabled for ['xpra.opengl.check', 'opengl']
2024-10-29 15:11:58,415 debug enabled for ['xpra.platform.win32.gl_context', 'opengl']
2024-10-29 15:11:58,415 gl client window module 'native'=<module 'xpra.client.gtk3.opengl.native_window' from 'C:\\Program Files\\Xpra\\lib\\xpra\\client\\gtk3\\opengl\\native_window.pyc'>
2024-10-29 15:11:58,415 check_support() GetModuleHandleW()=0x7ff7b59c0000
2024-10-29 15:11:58,415 check_support() RegisterClassExW()=0xc211
2024-10-29 15:11:58,415 check_support() CreateWindowExW()=0x160128
2024-10-29 15:11:58,415 create_wgl_context(0x160128) hdc=0x51010ac0
2024-10-29 15:11:58,415 init_opengl(probe-success)
Traceback (most recent call last):
  File "E:/xpra/xpra/client/gtk3/client_base.py", line 1215, in init_opengl
    self.opengl_props, gl_client_window_module = get_gl_client_window_module(enable_opengl)
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/xpra/xpra/opengl/window.py", line 61, in get_gl_client_window_module
    props, window_module = test_window_module(module_name, force_enable)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/xpra/xpra/opengl/window.py", line 80, in test_window_module
    opengl_props = mod.check_support(force_enable)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/xpra/xpra/client/gtk3/opengl/native_window.py", line 21, in check_support
    return GLContext().check_support(force_enable)  # pylint: disable=not-callable
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/xpra/xpra/platform/win32/gl_context.py", line 132, in check_support
    self.context = self.create_wgl_context(self.hwnd)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/xpra/xpra/platform/win32/gl_context.py", line 203, in create_wgl_context
    with cm:
  File "E:/xpra/xpra/util/io.py", line 131, in __enter__
    sys.stderr = os.fdopen(self.savedstderr, "w")
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 1031, in fdopen
OSError: [WinError 6] The handle is invalid
2024-10-29 15:11:58,415 OpenGL initialization error
Traceback (most recent call last):
  File "E:/xpra/xpra/client/gtk3/client_base.py", line 1215, in init_opengl
    self.opengl_props, gl_client_window_module = get_gl_client_window_module(enable_opengl)
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/xpra/xpra/opengl/window.py", line 61, in get_gl_client_window_module
    props, window_module = test_window_module(module_name, force_enable)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/xpra/xpra/opengl/window.py", line 80, in test_window_module
    opengl_props = mod.check_support(force_enable)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/xpra/xpra/client/gtk3/opengl/native_window.py", line 21, in check_support
    return GLContext().check_support(force_enable)  # pylint: disable=not-callable
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/xpra/xpra/platform/win32/gl_context.py", line 132, in check_support
    self.context = self.create_wgl_context(self.hwnd)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/xpra/xpra/platform/win32/gl_context.py", line 203, in create_wgl_context
    with cm:
  File "E:/xpra/xpra/util/io.py", line 131, in __enter__
    sys.stderr = os.fdopen(self.savedstderr, "w")
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 1031, in fdopen
OSError: [WinError 6] The handle is invalid
2024-10-29 15:11:58,415 Error loading OpenGL support:
2024-10-29 15:11:58,415  [WinError 6] The handle is invalid

Only one of the two commits above should really be needed, but together they should make the code more resilient to such failures in the future. I will be releasing 6.2.1 with this fix today. In the meantime, you can find 6.3-r36838 builds in the beta area: https://xpra.org/beta/windows/

totaam commented 3 weeks ago

Feel free to re-open if you are still having issues with 6.2.1 or later.