Ctrl+c to exit video not working & segfault on 2nd run #3

Closed
opened 2023-09-18 16:27:50 +00:00 by Kagukara · 25 comments

I'm unable to get any video running with xr-video-player. I downloaded it from the aur, and made sure SteamVR was running when running the commands listed below. I ran them twice as they gave slightly different results. If you need any more information let know so I can provide it.

Output for xr-video-player --video ~/path/to/video.mp4

  • First run:
Successfully got XrSystem with id 1154179431808368942 for HMD form factor
Successfully created a session with OpenGL!
Runtime supports 5 swapchain formats
Runtime supports 5 swapchain formats
Supported GL format: 0x8c41
Supported GL format: 0x8c43
Using preferred swapchain format 0x8c43
Runtime supports 5 swapchain formats
Supported GL format: 0x8c41
Supported GL format: 0x8c43
Supported GL format: 0x81a5
Using preferred swapchain format 0x81a5
swapchain_lengths: 3
swapchain_lengths: 3
[DEBUG] Created EGLDisplay 0x55f4991dadd0
EVENT: session state changed from 0 to 1
EVENT: session state changed from 1 to 2
Session started!
EVENT: session state changed from 2 to 3
Cannot load libcuda.so.1
Segmentation fault (core dumped)

Second run:

Successfully got XrSystem with id 1154179431808368942 for HMD form factor
Successfully created a session with OpenGL!
Runtime supports 5 swapchain formats
Runtime supports 5 swapchain formats
Supported GL format: 0x8c41
Supported GL format: 0x8c43
Using preferred swapchain format 0x8c43
Runtime supports 5 swapchain formats
Supported GL format: 0x8c41
Supported GL format: 0x8c43
Supported GL format: 0x81a5
Using preferred swapchain format 0x81a5
swapchain_lengths: 3
swapchain_lengths: 3
[DEBUG] Created EGLDisplay 0x562c4bd8add0
EVENT: session state changed from 0 to 1
EVENT: session state changed from 1 to 2
Session started!
Cannot load libcuda.so.1
[MPV] New size: 4000 2000
[MPV] New size: 4000 2000
Update size from 0 0 to 4000 2000
EVENT: session state changed from 2 to 3
Segmentation fault (core dumped)

Output for xr-video-player --use-system-mpv-config --video ~/path/to/video.mp4

  • First run:
Successfully got XrSystem with id 1154202590272028988 for HMD form factor
Successfully created a session with OpenGL!
Runtime supports 5 swapchain formats
Runtime supports 5 swapchain formats
Supported GL format: 0x8c41
Supported GL format: 0x8c43
Using preferred swapchain format 0x8c43
Runtime supports 5 swapchain formats
Supported GL format: 0x8c41
Supported GL format: 0x8c43
Supported GL format: 0x81a5
Using preferred swapchain format 0x81a5
swapchain_lengths: 3
swapchain_lengths: 3
[DEBUG] Created EGLDisplay 0x564cc381ec20
EVENT: session state changed from 0 to 1
EVENT: session state changed from 1 to 2
Session started!
EVENT: session state changed from 2 to 3
Cannot load libcuda.so.1
MPV quit
  • Second run:
Successfully got XrSystem with id 1154202590272028988 for HMD form factor
Successfully created a session with OpenGL!
Runtime supports 5 swapchain formats
Runtime supports 5 swapchain formats
Supported GL format: 0x8c41
Supported GL format: 0x8c43
Using preferred swapchain format 0x8c43
Runtime supports 5 swapchain formats
Supported GL format: 0x8c41
Supported GL format: 0x8c43
Supported GL format: 0x81a5
Using preferred swapchain format 0x81a5
swapchain_lengths: 3
swapchain_lengths: 3
[DEBUG] Created EGLDisplay 0x55970fd93b30
EVENT: session state changed from 0 to 1
EVENT: session state changed from 1 to 2
Session started!
Cannot load libcuda.so.1
MPV quit
EVENT: session state changed from 2 to 3
Segmentation fault (core dumped)

System Information

  • OS: Arch Linux
  • WM: sway version 1.8.1
  • Kernel: 6.5.3-arch1-1
  • GPU: AMD Radeon RX 7900 XTX (gfx1100, LLVM 18.0.0, DRM 3.54, 6.5.3-arch1-1)
  • GPU Driver: 4.6 Mesa 23.3.0-devel (git-dd6a7a8e61)
  • Headset: Valve Index
  • SteamVR Version: 1.27.5
  • MPV Version:
    • mpv 0.36.0 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
    • built on Sun Jul 23 05:49:29 2023
    • libplacebo version: v5.264.1
    • FFmpeg version: n6.0-12-ga6dc92968a
    • FFmpeg library versions:
      • libavutil 58.2.100
      • libavcodec 60.3.100
      • libavformat 60.3.100
      • libswscale 7.1.100
      • libavfilter 9.3.100
      • libswresample 4.10.100
  • Pipewire Version:
    • pipewire
    • Compiled with libpipewire 0.3.80
    • Linked with libpipewire 0.3.8
  • OpenXR Version:
    • openxr 1.0.29-1
    • openxr-git 1.0.29.r1.g435e7f4-1
    • openxr-headers-git 1.0.29.r1.g435e7f4-1
    • openxr-layers-git 1.0.29.r1.g435e7f4-1
    • openxr-loader-git 1.0.29.r1.g435e7f4-1
    • openxr-utils-git 1.0.29.r1.g435e7f4-1
I'm unable to get any video running with `xr-video-player`. I downloaded it from the [aur](https://aur.archlinux.org/packages/xr-video-player-git), and made sure SteamVR was running when running the commands listed below. I ran them twice as they gave slightly different results. If you need any more information let know so I can provide it. ### Output for `xr-video-player --video ~/path/to/video.mp4` - First run: ``` Successfully got XrSystem with id 1154179431808368942 for HMD form factor Successfully created a session with OpenGL! Runtime supports 5 swapchain formats Runtime supports 5 swapchain formats Supported GL format: 0x8c41 Supported GL format: 0x8c43 Using preferred swapchain format 0x8c43 Runtime supports 5 swapchain formats Supported GL format: 0x8c41 Supported GL format: 0x8c43 Supported GL format: 0x81a5 Using preferred swapchain format 0x81a5 swapchain_lengths: 3 swapchain_lengths: 3 [DEBUG] Created EGLDisplay 0x55f4991dadd0 EVENT: session state changed from 0 to 1 EVENT: session state changed from 1 to 2 Session started! EVENT: session state changed from 2 to 3 Cannot load libcuda.so.1 Segmentation fault (core dumped) ``` Second run: ``` Successfully got XrSystem with id 1154179431808368942 for HMD form factor Successfully created a session with OpenGL! Runtime supports 5 swapchain formats Runtime supports 5 swapchain formats Supported GL format: 0x8c41 Supported GL format: 0x8c43 Using preferred swapchain format 0x8c43 Runtime supports 5 swapchain formats Supported GL format: 0x8c41 Supported GL format: 0x8c43 Supported GL format: 0x81a5 Using preferred swapchain format 0x81a5 swapchain_lengths: 3 swapchain_lengths: 3 [DEBUG] Created EGLDisplay 0x562c4bd8add0 EVENT: session state changed from 0 to 1 EVENT: session state changed from 1 to 2 Session started! Cannot load libcuda.so.1 [MPV] New size: 4000 2000 [MPV] New size: 4000 2000 Update size from 0 0 to 4000 2000 EVENT: session state changed from 2 to 3 Segmentation fault (core dumped) ``` ### Output for `xr-video-player --use-system-mpv-config --video ~/path/to/video.mp4` - First run: ``` Successfully got XrSystem with id 1154202590272028988 for HMD form factor Successfully created a session with OpenGL! Runtime supports 5 swapchain formats Runtime supports 5 swapchain formats Supported GL format: 0x8c41 Supported GL format: 0x8c43 Using preferred swapchain format 0x8c43 Runtime supports 5 swapchain formats Supported GL format: 0x8c41 Supported GL format: 0x8c43 Supported GL format: 0x81a5 Using preferred swapchain format 0x81a5 swapchain_lengths: 3 swapchain_lengths: 3 [DEBUG] Created EGLDisplay 0x564cc381ec20 EVENT: session state changed from 0 to 1 EVENT: session state changed from 1 to 2 Session started! EVENT: session state changed from 2 to 3 Cannot load libcuda.so.1 MPV quit ``` - Second run: ``` Successfully got XrSystem with id 1154202590272028988 for HMD form factor Successfully created a session with OpenGL! Runtime supports 5 swapchain formats Runtime supports 5 swapchain formats Supported GL format: 0x8c41 Supported GL format: 0x8c43 Using preferred swapchain format 0x8c43 Runtime supports 5 swapchain formats Supported GL format: 0x8c41 Supported GL format: 0x8c43 Supported GL format: 0x81a5 Using preferred swapchain format 0x81a5 swapchain_lengths: 3 swapchain_lengths: 3 [DEBUG] Created EGLDisplay 0x55970fd93b30 EVENT: session state changed from 0 to 1 EVENT: session state changed from 1 to 2 Session started! Cannot load libcuda.so.1 MPV quit EVENT: session state changed from 2 to 3 Segmentation fault (core dumped) ``` ### System Information - OS: Arch Linux - WM: sway version 1.8.1 - Kernel: 6.5.3-arch1-1 - GPU: AMD Radeon RX 7900 XTX (gfx1100, LLVM 18.0.0, DRM 3.54, 6.5.3-arch1-1) - GPU Driver: 4.6 Mesa 23.3.0-devel (git-dd6a7a8e61) - Headset: Valve Index - SteamVR Version: 1.27.5 - MPV Version: - mpv 0.36.0 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects - built on Sun Jul 23 05:49:29 2023 - libplacebo version: v5.264.1 - FFmpeg version: n6.0-12-ga6dc92968a - FFmpeg library versions: - libavutil 58.2.100 - libavcodec 60.3.100 - libavformat 60.3.100 - libswscale 7.1.100 - libavfilter 9.3.100 - libswresample 4.10.100 - Pipewire Version: - pipewire - Compiled with libpipewire 0.3.80 - Linked with libpipewire 0.3.8 - OpenXR Version: - openxr 1.0.29-1 - openxr-git 1.0.29.r1.g435e7f4-1 - openxr-headers-git 1.0.29.r1.g435e7f4-1 - openxr-layers-git 1.0.29.r1.g435e7f4-1 - openxr-loader-git 1.0.29.r1.g435e7f4-1 - openxr-utils-git 1.0.29.r1.g435e7f4-1

Seems like it can run once but then you need to restart steam.

Working:

Successfully got XrSystem with id 1153005922189050309 for HMD form factor
Successfully created a session with OpenGL!
Runtime supports 5 swapchain formats
Runtime supports 5 swapchain formats
Supported GL format: 0x8c41
Supported GL format: 0x8c43
Using preferred swapchain format 0x8c43
Runtime supports 5 swapchain formats
Supported GL format: 0x8c41
Supported GL format: 0x8c43
Supported GL format: 0x81a5
Using preferred swapchain format 0x81a5
swapchain_lengths: 3
swapchain_lengths: 3
[DEBUG] Created EGLDisplay 0x5577063ff1e0
EVENT: session state changed from 0 to 1
EVENT: session state changed from 1 to 2
Session started!
EVENT: session state changed from 2 to 3
EVENT: session state changed from 3 to 4
EVENT: session state changed from 4 to 5
Cannot load libcuda.so.1
[MPV] New size: 4000 2000
[MPV] New size: 4000 2000
Update size from 0 0 to 4000 2000
[MPV] New size: 4000 2000
[MPV] New size: 4000 2000
EVENT: session state changed from 5 to 4
EVENT: session state changed from 4 to 3

Trying again after it worked:

Successfully got XrSystem with id 1153005922189050309 for HMD form factor
Successfully created a session with OpenGL!
Runtime supports 5 swapchain formats
Runtime supports 5 swapchain formats
Supported GL format: 0x8c41
Supported GL format: 0x8c43
Using preferred swapchain format 0x8c43
Runtime supports 5 swapchain formats
Supported GL format: 0x8c41
Supported GL format: 0x8c43
Supported GL format: 0x81a5
Using preferred swapchain format 0x81a5
swapchain_lengths: 3
swapchain_lengths: 3
[DEBUG] Created EGLDisplay 0x55fa47b5e1e0
EVENT: session state changed from 0 to 1
EVENT: session state changed from 1 to 2
Session started!
Cannot load libcuda.so.1
[MPV] New size: 4000 2000
[MPV] New size: 4000 2000
Update size from 0 0 to 4000 2000
EVENT: session state changed from 2 to 3
Segmentation fault (core dumped)

I have built from source but it has the same result.

Seems like it can run once but then you need to restart steam. ### Working: ``` Successfully got XrSystem with id 1153005922189050309 for HMD form factor Successfully created a session with OpenGL! Runtime supports 5 swapchain formats Runtime supports 5 swapchain formats Supported GL format: 0x8c41 Supported GL format: 0x8c43 Using preferred swapchain format 0x8c43 Runtime supports 5 swapchain formats Supported GL format: 0x8c41 Supported GL format: 0x8c43 Supported GL format: 0x81a5 Using preferred swapchain format 0x81a5 swapchain_lengths: 3 swapchain_lengths: 3 [DEBUG] Created EGLDisplay 0x5577063ff1e0 EVENT: session state changed from 0 to 1 EVENT: session state changed from 1 to 2 Session started! EVENT: session state changed from 2 to 3 EVENT: session state changed from 3 to 4 EVENT: session state changed from 4 to 5 Cannot load libcuda.so.1 [MPV] New size: 4000 2000 [MPV] New size: 4000 2000 Update size from 0 0 to 4000 2000 [MPV] New size: 4000 2000 [MPV] New size: 4000 2000 EVENT: session state changed from 5 to 4 EVENT: session state changed from 4 to 3 ``` ### Trying again after it worked: ``` Successfully got XrSystem with id 1153005922189050309 for HMD form factor Successfully created a session with OpenGL! Runtime supports 5 swapchain formats Runtime supports 5 swapchain formats Supported GL format: 0x8c41 Supported GL format: 0x8c43 Using preferred swapchain format 0x8c43 Runtime supports 5 swapchain formats Supported GL format: 0x8c41 Supported GL format: 0x8c43 Supported GL format: 0x81a5 Using preferred swapchain format 0x81a5 swapchain_lengths: 3 swapchain_lengths: 3 [DEBUG] Created EGLDisplay 0x55fa47b5e1e0 EVENT: session state changed from 0 to 1 EVENT: session state changed from 1 to 2 Session started! Cannot load libcuda.so.1 [MPV] New size: 4000 2000 [MPV] New size: 4000 2000 Update size from 0 0 to 4000 2000 EVENT: session state changed from 2 to 3 Segmentation fault (core dumped) ``` I have built from source but it has the same result.

Exiting within VR by pressing the SteamVR options button on the controller, going to "EXIT GAME" or burger menu and "EXIT OPENXR OPENGL EXAMPLE" allows xr-video-player to get Killed. Which then allows you to manually pick and play another video.

Before I was closing the video by pressing Ctrl+c in the terminal that the video was running from.

When the video finishes its a black screen until you manually exit OpenXR OpenGL Example (xr-video-player) in SteamVR.

Output:

Successfully got XrSystem with id 1153104152386077124 for HMD form factor
Successfully created a session with OpenGL!
Runtime supports 5 swapchain formats
Runtime supports 5 swapchain formats
Supported GL format: 0x8c41
Supported GL format: 0x8c43
Using preferred swapchain format 0x8c43
Runtime supports 5 swapchain formats
Supported GL format: 0x8c41
Supported GL format: 0x8c43
Supported GL format: 0x81a5
Using preferred swapchain format 0x81a5
swapchain_lengths: 3
swapchain_lengths: 3
[DEBUG] Created EGLDisplay 0x55e4a3ae21d0
EVENT: session state changed from 0 to 1
EVENT: session state changed from 1 to 2
Session started!
EVENT: session state changed from 2 to 3
EVENT: session state changed from 3 to 4
EVENT: session state changed from 4 to 5
Cannot load libcuda.so.1
[MPV] New size: 4096 2048
[MPV] New size: 4096 2048
Update size from 0 0 to 4096 2048
EVENT: session state changed from 5 to 4
EVENT: session state changed from 4 to 5
EVENT: session state changed from 5 to 4
EVENT: session state changed from 4 to 5
EVENT: session state changed from 5 to 4
EVENT: session state changed from 4 to 5
EVENT: session state changed from 5 to 4
[MPV] New size: 4096 2048
[MPV] New size: 4096 2048
EVENT: session state changed from 4 to 3
EVENT: session state changed from 3 to 6
EVENT: session state changed from 6 to 1
EVENT: session state changed from 1 to 8
Killed

If this is working as intended, can I get a confirmation before closing the issue?

Exiting within VR by pressing the SteamVR options button on the controller, going to "EXIT GAME" or burger menu and "EXIT OPENXR OPENGL EXAMPLE" allows `xr-video-player` to get `Killed`. Which then allows you to manually pick and play another video. Before I was closing the video by pressing Ctrl+c in the terminal that the video was running from. When the video finishes its a black screen until you manually exit OpenXR OpenGL Example (`xr-video-player`) in SteamVR. ### Output: ``` Successfully got XrSystem with id 1153104152386077124 for HMD form factor Successfully created a session with OpenGL! Runtime supports 5 swapchain formats Runtime supports 5 swapchain formats Supported GL format: 0x8c41 Supported GL format: 0x8c43 Using preferred swapchain format 0x8c43 Runtime supports 5 swapchain formats Supported GL format: 0x8c41 Supported GL format: 0x8c43 Supported GL format: 0x81a5 Using preferred swapchain format 0x81a5 swapchain_lengths: 3 swapchain_lengths: 3 [DEBUG] Created EGLDisplay 0x55e4a3ae21d0 EVENT: session state changed from 0 to 1 EVENT: session state changed from 1 to 2 Session started! EVENT: session state changed from 2 to 3 EVENT: session state changed from 3 to 4 EVENT: session state changed from 4 to 5 Cannot load libcuda.so.1 [MPV] New size: 4096 2048 [MPV] New size: 4096 2048 Update size from 0 0 to 4096 2048 EVENT: session state changed from 5 to 4 EVENT: session state changed from 4 to 5 EVENT: session state changed from 5 to 4 EVENT: session state changed from 4 to 5 EVENT: session state changed from 5 to 4 EVENT: session state changed from 4 to 5 EVENT: session state changed from 5 to 4 [MPV] New size: 4096 2048 [MPV] New size: 4096 2048 EVENT: session state changed from 4 to 3 EVENT: session state changed from 3 to 6 EVENT: session state changed from 6 to 1 EVENT: session state changed from 1 to 8 Killed ``` If this is working as intended, can I get a confirmation before closing the issue?

I currently have no working setup for SteamVR so I can / have only tested the application against monado.

I was unable to reproduce the segfault with monado.

"Ctrl+c" in the terminal caused a normal shutdown (while a video was running or after it is finished) and starting another video afterwards was no problem.

It does not seam to be the case that "Ctrl+c" causes a different, less controlled, shutdown compared to other ways.

When the video finishes its a black screen until you manually exit OpenXR OpenGL Example (xr-video-player) in SteamVR.

That is currently the intended behavior. Not quite so intended is the high CPU usage after the video is finished ... going to look into that, when I have a bit of time.

Another option to close the application is by pressing "esc" while the xr-video-player companion window is focused.
(... I am somewhat surprised that I have forgotten to mention this in the readme, I am going to rectify that in the future)

Thank you, for your issue, but as I am unable to reproduce the segfault on my machine, I can not work towards a resolution for that. If you want too, you could try to debug the applications second run after a "Ctrl+c" and post about where the segfault occurred, that might help us / me figure out what the problem is.

But I also do not mind if you close the issue if you are satisfied with this response.

Also thanks for inadvertently pointing out that the application presents itself as "OpenXR OpenGL Example" to the runtime, I am going to fix that :)

I currently have no working setup for SteamVR so I can / have only tested the application against monado. I was unable to reproduce the segfault with monado. "Ctrl+c" in the terminal caused a normal shutdown (while a video was running or after it is finished) and starting another video afterwards was no problem. It does not seam to be the case that "Ctrl+c" causes a different, less controlled, shutdown compared to other ways. > When the video finishes its a black screen until you manually exit OpenXR OpenGL Example (xr-video-player) in SteamVR. That is currently the intended behavior. Not quite so intended is the high CPU usage after the video is finished ... going to look into that, when I have a bit of time. Another option to close the application is by pressing "esc" while the xr-video-player companion window is focused. (... I am somewhat surprised that I have forgotten to mention this in the readme, I am going to rectify that in the future) Thank you, for your issue, but as I am unable to reproduce the segfault on my machine, I can not work towards a resolution for that. If you want too, you could try to debug the applications second run after a "Ctrl+c" and post about where the segfault occurred, that might help us / me figure out what the problem is. But I also do not mind if you close the issue if you are satisfied with this response. Also thanks for inadvertently pointing out that the application presents itself as "OpenXR OpenGL Example" to the runtime, I am going to fix that :)

Full output from running $ gdb --args xr-video-player --video ~/downloads/vr/playlist.m3u: https://hastebin.com/share/vesodojuyo.yaml

After pressing "Crtl+c"/^C xr-video-player is still on the desktop as a black window, shows up in btop and is showing as "waiting..." in SteamVR (in vr)

Pressing Esc instead of Ctrl+c shows:

[Thread 0x7fffbdb3a6c0 (LWP 38319) exited]
[Thread 0x7fff777fe6c0 (LWP 38337) exited]
[Thread 0x7fff94ffc6c0 (LWP 38335) exited]
[Thread 0x7fff95ffe6c0 (LWP 38333) exited]
[Thread 0x7fff77fff6c0 (LWP 38336) exited]
[Thread 0x7fff957fd6c0 (LWP 38334) exited]
[Thread 0x7fff967ff6c0 (LWP 38332) exited]
[Thread 0x7fff9d3ff6c0 (LWP 38330) exited]
[Thread 0x7fff97fff6c0 (LWP 38328) exited]
[Thread 0x7fffbcaac6c0 (LWP 38321) exited]
[Thread 0x7fff9f7fe6c0 (LWP 38323) exited]
[Thread 0x7fff9ffff6c0 (LWP 38322) exited]
[Thread 0x7fffbd2ad6c0 (LWP 38320) exited]
[Thread 0x7fff763fc6c0 (LWP 38347) exited]
[Thread 0x7fff753fa6c0 (LWP 38356) exited]
[Thread 0x7fff75bfb6c0 (LWP 38350) exited]
[Thread 0x7fff9e7ff6c0 (LWP 38329) exited]
[Thread 0x7fffbe33b6c0 (LWP 38318) exited]
[Thread 0x7fffbeb7d6c0 (LWP 38317) exited]
[Thread 0x7fffbffff6c0 (LWP 38308) exited]
[Thread 0x7fffd48ba6c0 (LWP 38307) exited]
[Thread 0x7fffbf57e6c0 (LWP 38316) exited]
[Thread 0x7fffd5cbc6c0 (LWP 38305) exited]
[Thread 0x7fffd54bb6c0 (LWP 38306) exited]
[Thread 0x7fffd64bd6c0 (LWP 38304) exited]
[Thread 0x7fffd6dff6c0 (LWP 38303) exited]
[Thread 0x7fffe325c6c0 (LWP 38299) exited]
[Thread 0x7fff9cbfe6c0 (LWP 38331) exited]

I then have to press "Crtl+c" to exit. xr-video-player window is closed but is still showing up in btop.

After pressing "Crtl+c"/^C:

^C
Thread 1 "xr-video-player" received signal SIGINT, Interrupt.
futex_wait (private=<optimized out>, expected=12, futex_word=0x7fffe28e6734 <g_hmdSystem+7188>) at ../sysdeps/nptl/futex-internal.h:146
Downloading source file /usr/src/debug/glibc/glibc/nptl/../sysdeps/nptl/futex-internal.h
146	 int err = lll_futex_timed_wait (futex_word, expected, NULL, private);                                                                                                 
(gdb) quit
A debugging session is active.

	Inferior 1 [process 38292] will be killed.

Quit anyway? (y or n) y
  • I get the segfault if I run it out of gdb as it was ran once in even though the once was in gdb
  • I can run it a second time in gdb even if I cannot run it a second time out of gdb.
    • Example:
      1. run in gdb (works)
      2. quit gdb and run it normally (doesn't work)
        • When xr-video-player is run here it gives the segfault and also doesn't show as running in btop.
      3. run it in gdb again (works)
  • The only other time I've gotten a segfault was with blender, which is now been fixed. Here was the bug issue: https://bugs.archlinux.org/task/79506. Not sure if it helps at all though.

Hope this helps diagnose the issue better, if it doesn't what would you suggest I try next?

Full output from running `$ gdb --args xr-video-player --video ~/downloads/vr/playlist.m3u`: [https://hastebin.com/share/vesodojuyo.yaml](https://hastebin.com/share/vesodojuyo.yaml) After pressing "Crtl+c"/`^C` `xr-video-player` is still on the desktop as a black window, shows up in `btop` and is showing as "waiting..." in SteamVR (in vr) Pressing Esc instead of Ctrl+c shows: ``` [Thread 0x7fffbdb3a6c0 (LWP 38319) exited] [Thread 0x7fff777fe6c0 (LWP 38337) exited] [Thread 0x7fff94ffc6c0 (LWP 38335) exited] [Thread 0x7fff95ffe6c0 (LWP 38333) exited] [Thread 0x7fff77fff6c0 (LWP 38336) exited] [Thread 0x7fff957fd6c0 (LWP 38334) exited] [Thread 0x7fff967ff6c0 (LWP 38332) exited] [Thread 0x7fff9d3ff6c0 (LWP 38330) exited] [Thread 0x7fff97fff6c0 (LWP 38328) exited] [Thread 0x7fffbcaac6c0 (LWP 38321) exited] [Thread 0x7fff9f7fe6c0 (LWP 38323) exited] [Thread 0x7fff9ffff6c0 (LWP 38322) exited] [Thread 0x7fffbd2ad6c0 (LWP 38320) exited] [Thread 0x7fff763fc6c0 (LWP 38347) exited] [Thread 0x7fff753fa6c0 (LWP 38356) exited] [Thread 0x7fff75bfb6c0 (LWP 38350) exited] [Thread 0x7fff9e7ff6c0 (LWP 38329) exited] [Thread 0x7fffbe33b6c0 (LWP 38318) exited] [Thread 0x7fffbeb7d6c0 (LWP 38317) exited] [Thread 0x7fffbffff6c0 (LWP 38308) exited] [Thread 0x7fffd48ba6c0 (LWP 38307) exited] [Thread 0x7fffbf57e6c0 (LWP 38316) exited] [Thread 0x7fffd5cbc6c0 (LWP 38305) exited] [Thread 0x7fffd54bb6c0 (LWP 38306) exited] [Thread 0x7fffd64bd6c0 (LWP 38304) exited] [Thread 0x7fffd6dff6c0 (LWP 38303) exited] [Thread 0x7fffe325c6c0 (LWP 38299) exited] [Thread 0x7fff9cbfe6c0 (LWP 38331) exited] ``` I then have to press "Crtl+c" to exit. `xr-video-player` window is closed but is still showing up in `btop`. After pressing "Crtl+c"/`^C`: ``` ^C Thread 1 "xr-video-player" received signal SIGINT, Interrupt. futex_wait (private=<optimized out>, expected=12, futex_word=0x7fffe28e6734 <g_hmdSystem+7188>) at ../sysdeps/nptl/futex-internal.h:146 Downloading source file /usr/src/debug/glibc/glibc/nptl/../sysdeps/nptl/futex-internal.h 146 int err = lll_futex_timed_wait (futex_word, expected, NULL, private); (gdb) quit A debugging session is active. Inferior 1 [process 38292] will be killed. Quit anyway? (y or n) y ``` - I get the segfault if I run it out of `gdb` as it was ran once in even though the once was in `gdb` - I can run it a second time in gdb even if I cannot run it a second time out of `gdb`. - Example: 1. run in `gdb` (works) 2. quit `gdb` and run it normally (doesn't work) - When `xr-video-player` is run here it gives the segfault and also doesn't show as running in `btop`. 3. run it in `gdb` again (works) - The only other time I've gotten a segfault was with blender, which is now been fixed. Here was the bug issue: [https://bugs.archlinux.org/task/79506](https://bugs.archlinux.org/task/79506). Not sure if it helps at all though. Hope this helps diagnose the issue better, if it doesn't what would you suggest I try next?
Kagukara changed title from Unable to play videos to Ctrl+c to exit video not working 2023-09-20 20:24:30 +00:00

gdb by default catches the signal SIGINT by ctrl+c and halts the program so you can debug and prevents the debugged application from ever seeing the signal.

The first command in the following example lets gdb pass the signal on and tells it to not stop when encountering the signal.

(gdb) handle SIGINT nostop 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        No        Yes     Yes             Interrupt
(gdb) run

... program runs and plays a video

^C
Thread 1 "xr-video-player" received signal SIGINT, Interrupt.
quit
[Thread 0x7fff9b7fe6c0 (LWP 66995) exited]
[Thread 0x7fff40ff96c0 (LWP 67022) exited]
[Thread 0x7fff41ffb6c0 (LWP 67020) exited]
[Thread 0x7fff427fc6c0 (LWP 67019) exited]
[Thread 0x7fff417fa6c0 (LWP 67021) exited]
[Thread 0x7fff42ffd6c0 (LWP 67018) exited]
[Thread 0x7fff437fe6c0 (LWP 67017) exited]
[Thread 0x7fff43fff6c0 (LWP 67016) exited]
[Thread 0x7fff64ff96c0 (LWP 67015) exited]
[Thread 0x7fff657fa6c0 (LWP 67014) exited]
[Thread 0x7fff667fc6c0 (LWP 67012) exited]
[Thread 0x7fff677fe6c0 (LWP 67010) exited]
[Thread 0x7fff8111a6c0 (LWP 67007) exited]
[Thread 0x7fff809196c0 (LWP 67008) exited]
[Thread 0x7fff65ffb6c0 (LWP 67013) exited]
[Thread 0x7fff66ffd6c0 (LWP 67011) exited]
[Thread 0x7fff67fff6c0 (LWP 67009) exited]
[Thread 0x7fff8191b6c0 (LWP 67006) exited]
[Thread 0x7fff82ffd6c0 (LWP 67005) exited]
[Thread 0x7fff83fff6c0 (LWP 67003) exited]
[Thread 0x7fff99ffb6c0 (LWP 66998) exited]
[Thread 0x7fff997fa6c0 (LWP 66999) exited]
[Thread 0x7fff9a7fc6c0 (LWP 66996) exited]
[Thread 0x7fff98ff96c0 (LWP 67000) exited]
[Thread 0x7fff23fff6c0 (LWP 67023) exited]
[Thread 0x7fff2376f6c0 (LWP 67024) exited]
[Thread 0x7fff837fe6c0 (LWP 67004) exited]
[Thread 0x7fff9bfff6c0 (LWP 66994) exited]
[Thread 0x7fffbcff96c0 (LWP 66993) exited]
[Thread 0x7fffd4f496c0 (LWP 66985) exited]
[Thread 0x7fffd578b6c0 (LWP 66984) exited]
[Thread 0x7fffbf7fe6c0 (LWP 66988) exited]
[Thread 0x7fffbffff6c0 (LWP 66987) exited]
[Thread 0x7fffbdffb6c0 (LWP 66991) exited]
[Thread 0x7fffbe7fc6c0 (LWP 66990) exited]
[Thread 0x7fffd6bc26c0 (LWP 66982) exited]
[Thread 0x7fffd63c16c0 (LWP 66983) exited]
[Thread 0x7fff9affd6c0 (LWP 66997) exited]
[Thread 0x7fffbd7fa6c0 (LWP 66992) exited]
[Thread 0x7fffbeffd6c0 (LWP 66989) exited]
[Thread 0x7fffd73c36c0 (LWP 66981) exited]
[Thread 0x7fffd7d056c0 (LWP 66980) exited]
[Thread 0x7fffe338c6c0 (LWP 66978) exited]
[Inferior 1 (process 66916) exited normally]
(gdb) exit

Please test again with this modification and report back :)

The only other time I've gotten a segfault was with blender, which is now been fixed. Here was the bug issue: https://bugs.archlinux.org/task/79506. Not sure if it helps at all though.

I don't think that this is the same problem here, this application does not seem to link against LLVM directly (ldd /path/to/xr-video-player | grep -i llvm returns nothing).

`gdb` by default catches the signal `SIGINT` by `ctrl+c` and halts the program so you can debug and prevents the debugged application from ever seeing the signal. The first command in the following example lets `gdb` pass the signal on and tells it to not stop when encountering the signal. ``` (gdb) handle SIGINT nostop 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 No Yes Yes Interrupt (gdb) run ... program runs and plays a video ^C Thread 1 "xr-video-player" received signal SIGINT, Interrupt. quit [Thread 0x7fff9b7fe6c0 (LWP 66995) exited] [Thread 0x7fff40ff96c0 (LWP 67022) exited] [Thread 0x7fff41ffb6c0 (LWP 67020) exited] [Thread 0x7fff427fc6c0 (LWP 67019) exited] [Thread 0x7fff417fa6c0 (LWP 67021) exited] [Thread 0x7fff42ffd6c0 (LWP 67018) exited] [Thread 0x7fff437fe6c0 (LWP 67017) exited] [Thread 0x7fff43fff6c0 (LWP 67016) exited] [Thread 0x7fff64ff96c0 (LWP 67015) exited] [Thread 0x7fff657fa6c0 (LWP 67014) exited] [Thread 0x7fff667fc6c0 (LWP 67012) exited] [Thread 0x7fff677fe6c0 (LWP 67010) exited] [Thread 0x7fff8111a6c0 (LWP 67007) exited] [Thread 0x7fff809196c0 (LWP 67008) exited] [Thread 0x7fff65ffb6c0 (LWP 67013) exited] [Thread 0x7fff66ffd6c0 (LWP 67011) exited] [Thread 0x7fff67fff6c0 (LWP 67009) exited] [Thread 0x7fff8191b6c0 (LWP 67006) exited] [Thread 0x7fff82ffd6c0 (LWP 67005) exited] [Thread 0x7fff83fff6c0 (LWP 67003) exited] [Thread 0x7fff99ffb6c0 (LWP 66998) exited] [Thread 0x7fff997fa6c0 (LWP 66999) exited] [Thread 0x7fff9a7fc6c0 (LWP 66996) exited] [Thread 0x7fff98ff96c0 (LWP 67000) exited] [Thread 0x7fff23fff6c0 (LWP 67023) exited] [Thread 0x7fff2376f6c0 (LWP 67024) exited] [Thread 0x7fff837fe6c0 (LWP 67004) exited] [Thread 0x7fff9bfff6c0 (LWP 66994) exited] [Thread 0x7fffbcff96c0 (LWP 66993) exited] [Thread 0x7fffd4f496c0 (LWP 66985) exited] [Thread 0x7fffd578b6c0 (LWP 66984) exited] [Thread 0x7fffbf7fe6c0 (LWP 66988) exited] [Thread 0x7fffbffff6c0 (LWP 66987) exited] [Thread 0x7fffbdffb6c0 (LWP 66991) exited] [Thread 0x7fffbe7fc6c0 (LWP 66990) exited] [Thread 0x7fffd6bc26c0 (LWP 66982) exited] [Thread 0x7fffd63c16c0 (LWP 66983) exited] [Thread 0x7fff9affd6c0 (LWP 66997) exited] [Thread 0x7fffbd7fa6c0 (LWP 66992) exited] [Thread 0x7fffbeffd6c0 (LWP 66989) exited] [Thread 0x7fffd73c36c0 (LWP 66981) exited] [Thread 0x7fffd7d056c0 (LWP 66980) exited] [Thread 0x7fffe338c6c0 (LWP 66978) exited] [Inferior 1 (process 66916) exited normally] (gdb) exit ``` Please test again with this modification and report back :) > The only other time I've gotten a segfault was with blender, which is now been fixed. Here was the bug issue: https://bugs.archlinux.org/task/79506. Not sure if it helps at all though. I don't think that this is the same problem here, this application does not seem to link against LLVM directly (`ldd /path/to/xr-video-player | grep -i llvm` returns nothing).

Here is the new gdb log, ran with handle SIGINT nostop pass set to y: https://hastebin.com/share/wotahuvoli.yaml

After the first ctrl+c it was still running in btop (added a capture), it wasn't till after another ctrl+c it closed.

Here is the new `gdb` log, ran with `handle SIGINT nostop pass` set to `y`: [https://hastebin.com/share/wotahuvoli.yaml](https://hastebin.com/share/wotahuvoli.yaml) After the first `ctrl+c` it was still running in btop (added a capture), it wasn't till after another `ctrl+c` it closed.

It is weird that you have to press ctrl+c twice ... might for some reason be a difference because of SteamVr, but I am not sure why it would make such kind of a difference ...

Kind of forgot that the segfault was not caused by the ctrl+c directly... so my previous response did not really help us ...

I am going to look a bit closer at the logs you already provided and see if I can deduce a something useful. That will take a bit of time, going to report if I find something.

run it in gdb again (works)

Just to clarify, you do not only mean that is does not segfault, but that is completely works right (you can see the video via headset)? Same for the last log from a bit ago, correct?

It is weird that you have to press `ctrl+c `twice ... might for some reason be a difference because of SteamVr, but I am not sure why it would make such kind of a difference ... Kind of forgot that the segfault was not caused by the `ctrl+c` directly... so my previous response did not really help us ... I am going to look a bit closer at the logs you already provided and see if I can deduce a something useful. That will take a bit of time, going to report if I find something. > run it in gdb again (works) Just to clarify, you do not only mean that is does not segfault, but that is completely works right (you can see the video via headset)? Same for the last log from a bit ago, correct?

run it in gdb again (works)

Just to clarify, you do not only mean that is does not segfault, but that is completely works right (you can see the video via headset)? Same for the last log from a bit ago, correct?

When I run inside the gdb a second time it will show the video inside the headset and the xr-video-player window will appear.

First time running xr-video-player in gdb then exiting out and running it in the terminal will give the segfault.

If I run it again, now being the 3rd attempted inside gdb it will run correctly.

Doing the 4th run for instance inside gdb without exiting, xr-video-player will work correctly. I could also just exit out of gdb and go back into gdb to run it and it will work correctly.

I hope that clarifies things better.

> > run it in gdb again (works) > > Just to clarify, you do not only mean that is does not segfault, but that is completely works right (you can see the video via headset)? Same for the last log from a bit ago, correct? When I `run` inside the `gdb` a second time it will show the video inside the headset and the `xr-video-player` window will appear. First time running `xr-video-player` in `gdb` then exiting out and running it in the terminal will give the segfault. If I run it again, now being the 3rd attempted inside `gdb` it will run correctly. Doing the 4th run for instance inside `gdb` without exiting, `xr-video-player` will work correctly. I could also just exit out of `gdb` and go back into `gdb` to run it and it will work correctly. I hope that clarifies things better.

I manged to get it to segfault in gdb: https://hastebin.com/share/vusalozeju.yaml

EDIT: Never mind, the file was moved from this path. Forgot to change it.

I manged to get it to segfault in `gdb`: [https://hastebin.com/share/vusalozeju.yaml](https://hastebin.com/share/vusalozeju.yaml) EDIT: Never mind, the file was moved from this path. Forgot to change it.

I can reproduce the segfault in gdb by trying it with --use-system-mpv-config and --use-system-mpv-config ~/.config/mpv/mpv.conf though:

After a first run --use-system-mpv-config hastebin link

After a first run --use-system-mpv-config ~/.config/mpv/mpv.conf hastebin link

Wasn't sure if I had to pass the mpv.conf location or not so I tried it with both. There is only the "Xr-Video-Plyer Waiting..." box inside the headset (screenshot of what I mean below).

The process of this segfault is the same as running it outside of gdb.

  • I can see the video the first time it is launched, but the video doesn't play.
  • Running it a second time it does the segfault and only shows the "Xr-Video-Plyer Waiting..." box, happens inside and out of gdb.
  • To get it to at least show like the first run (video doesn't play) I have to restart SteamVR.
  • "Xr-Video-Plyer" might want to change it to "Xr-Video-Player" or "xr-video-player".
I can reproduce the segfault in `gdb` by trying it with `--use-system-mpv-config` and `--use-system-mpv-config ~/.config/mpv/mpv.conf` though: [After a first run `--use-system-mpv-config` hastebin link](https://hastebin.com/share/colejineze.yaml) [After a first run `--use-system-mpv-config ~/.config/mpv/mpv.conf` hastebin link](https://hastebin.com/share/dasugudaxe.yaml) Wasn't sure if I had to pass the `mpv.conf` location or not so I tried it with both. There is only the "Xr-Video-Plyer Waiting..." box inside the headset (screenshot of what I mean below). The process of this segfault is the same as running it outside of `gdb`. - I can see the video the first time it is launched, but the video doesn't play. - [First run `--use-system-mpv-config` hastebin link](https://hastebin.com/share/oyunawamoq.yaml) - Running it a second time it does the segfault and only shows the "Xr-Video-Plyer Waiting..." box, happens inside and out of `gdb`. - To get it to at least show like the first run (video doesn't play) I have to restart SteamVR. * "Xr-Video-Plyer" might want to change it to "Xr-Video-Player" or "xr-video-player".

Neat that you now are able to reproduce the segfault with gdb.

Please repeat a run in gdb and after the segfault is caught enter backtrace and list before exit and report back.

I am not really experienced with gdb so please excuse my step by step instructions of what to do ... :)

"Xr-Video-Plyer" might want to change it to "Xr-Video-Player" or "xr-video-player".

... of course I made such a clever mistake ...

Neat that you now are able to reproduce the segfault with `gdb`. Please repeat a run in `gdb` and after the segfault is caught enter `backtrace` and `list` before `exit` and report back. I am not really experienced with gdb so please excuse my step by step instructions of what to do ... :) > "Xr-Video-Plyer" might want to change it to "Xr-Video-Player" or "xr-video-player". ... of course I made such a _clever_ mistake ...
(gdb) backtrace
#0  0x00007fffe2468288 in LfMutexUnlockRobust(LfMutex*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so
#1  0x00007fffe23af41a in CSyncLockThread::Run() () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so
#2  0x00007fffe2446219 in CThread::ThreadProc(void*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so
#3  0x00007ffff6c8c9eb in start_thread (arg=<optimized out>) at pthread_create.c:444
#4  0x00007ffff6d10dfc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
(gdb) list
Downloading source file /usr/src/debug/glibc/glibc/nptl/<built-in>
1	/usr/src/debug/glibc/glibc/nptl/<built-in>: Directory not empty.

Here you go, I checked it twice and it shows the same result both times.

``` (gdb) backtrace #0 0x00007fffe2468288 in LfMutexUnlockRobust(LfMutex*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so #1 0x00007fffe23af41a in CSyncLockThread::Run() () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so #2 0x00007fffe2446219 in CThread::ThreadProc(void*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so #3 0x00007ffff6c8c9eb in start_thread (arg=<optimized out>) at pthread_create.c:444 #4 0x00007ffff6d10dfc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78 (gdb) list Downloading source file /usr/src/debug/glibc/glibc/nptl/<built-in> 1 /usr/src/debug/glibc/glibc/nptl/<built-in>: Directory not empty. ``` Here you go, I checked it twice and it shows the same result both times.

I accidentally closed, whoops.

I accidentally closed, whoops.
Kagukara reopened this issue 2023-09-23 13:03:23 +00:00

Oh that is probably due to my playlist.m3u not being setup properly as I edited it yesterday. Trying to get the same segfault as yesterday but not having any luck.

playlist.m3u was pointing to a folder not a list of videos.

Oh that is probably due to my `playlist.m3u` not being setup properly as I edited it yesterday. Trying to get the same segfault as yesterday but not having any luck. `playlist.m3u` was pointing to a folder not a list of videos.

Never mind, got the same, with the playlist.m3u set correctly:

(gdb) backtrace
#0  0x00007fffe2468288 in LfMutexUnlockRobust(LfMutex*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so
#1  0x00007fffe23af41a in CSyncLockThread::Run() () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so
#2  0x00007fffe2446219 in CThread::ThreadProc(void*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so
#3  0x00007ffff6c8c9eb in start_thread (arg=<optimized out>) at pthread_create.c:444
#4  0x00007ffff6d10dfc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
(gdb) list
1	/usr/src/debug/glibc/glibc/nptl/<built-in>: Bad file descriptor.

Double checked the playlist.m3u as well.

Never mind, got the same, with the `playlist.m3u` set correctly: ``` (gdb) backtrace #0 0x00007fffe2468288 in LfMutexUnlockRobust(LfMutex*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so #1 0x00007fffe23af41a in CSyncLockThread::Run() () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so #2 0x00007fffe2446219 in CThread::ThreadProc(void*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so #3 0x00007ffff6c8c9eb in start_thread (arg=<optimized out>) at pthread_create.c:444 #4 0x00007ffff6d10dfc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78 (gdb) list 1 /usr/src/debug/glibc/glibc/nptl/<built-in>: Bad file descriptor. ``` Double checked the `playlist.m3u` as well.

I'll see if I can set up monado to check if I get the same issue.

I'll see if I can set up monado to check if I get the same issue.

I'll see if I can set up monado to check if I get the same issue.

No luck in getting monado working.

Steps I did to install monado:

  1. Found this comment on a reddit post saying to install libsurvive-git, monado-git and follow the instructions in the OpenOVR README under "Linux-specific info".
    • Installed libsurvive-git, monado-git and got the 64-bit Linux build that was availible in the "Linux-specific info" section.
  2. Edited the ~/.config/openvr/openvrpaths.vrpath and replaced the "runtime" section to /home/richard/OpenComposite. Also made the file read only with chmod 0444 ~/.config/openvr/openvrpaths.vrpath.
    • ~/OpenComposite was extracted from the OpenOVR 64-bit Linux build zip file and placed in the home directory.
  3. Ran monado.service, headsets screens lit out and looked like it was working.
  4. Ran xr-video-player --video ~/videos/VR/playlist.m3u, which output:
Error [GENERAL | xrCreateInstance | OpenXR-Loader] : LoaderInstance::CreateInstance chained CreateInstance call failed
Error [GENERAL | xrCreateInstance | OpenXR-Loader] : xrCreateInstance failed
Error [GENERAL | xrResultToString | OpenXR-Loader] : No active XrInstance handle.
Failed to create XR instance. [px] (-2)
> I'll see if I can set up monado to check if I get the same issue. No luck in getting monado working. Steps I did to install monado: 1. Found this [comment](https://www.reddit.com/r/virtualreality_linux/comments/z81u6r/comment/iyaelda/?utm_source=share&utm_medium=web2x&context=3) on a reddit post saying to install libsurvive-git, monado-git and follow the instructions in the [OpenOVR](https://gitlab.com/znixian/OpenOVR) README under "Linux-specific info". - Installed libsurvive-git, monado-git and got the 64-bit Linux build that was availible in the "Linux-specific info" section. 2. Edited the `~/.config/openvr/openvrpaths.vrpath` and replaced the "runtime" section to `/home/richard/OpenComposite`. Also made the file read only with `chmod 0444 ~/.config/openvr/openvrpaths.vrpath`. - `~/OpenComposite` was extracted from the OpenOVR 64-bit Linux build zip file and placed in the home directory. 3. Ran `monado.service`, headsets screens lit out and looked like it was working. 4. Ran `xr-video-player --video ~/videos/VR/playlist.m3u`, which output: ``` Error [GENERAL | xrCreateInstance | OpenXR-Loader] : LoaderInstance::CreateInstance chained CreateInstance call failed Error [GENERAL | xrCreateInstance | OpenXR-Loader] : xrCreateInstance failed Error [GENERAL | xrResultToString | OpenXR-Loader] : No active XrInstance handle. Failed to create XR instance. [px] (-2) ```
Collaborator

@yoshino I think this happens because steamvr has a bug where it breaks unless the application cleanly shuts down steamvr. Since openxr is used here I think you need to use xrRequestExitSession when pressing Esc which will then make openxr go into the state XR_SESSION_STATE_EXITING and call xrDestroySession. Then call xrDestroyInstance at the end. At least, that's how it's done here: https://gitlab.freedesktop.org/monado/demos/openxr-simple-example/-/blob/master/main.c?ref_type=heads
since ctrl+c shuts down the application without doing that you also need to catch the SIGINT signal to make it cleanly shutdown instead, see: https://git.dec05eba.com/vr-video-player/tree/src/main.cpp#n2782 but in this case it would have to be modified a bit since I dont think you can call xrRequestExitSession from a signal handler.

@yoshino I think this happens because steamvr has a bug where it breaks unless the application cleanly shuts down steamvr. Since openxr is used here I think you need to use xrRequestExitSession when pressing Esc which will then make openxr go into the state XR_SESSION_STATE_EXITING and call xrDestroySession. Then call xrDestroyInstance at the end. At least, that's how it's done here: https://gitlab.freedesktop.org/monado/demos/openxr-simple-example/-/blob/master/main.c?ref_type=heads since ctrl+c shuts down the application without doing that you also need to catch the SIGINT signal to make it cleanly shutdown instead, see: https://git.dec05eba.com/vr-video-player/tree/src/main.cpp#n2782 but in this case it would have to be modified a bit since I dont think you can call xrRequestExitSession from a signal handler.
Kagukara changed title from Ctrl+c to exit video not working to Ctrl+c to exit video not working & segfault on 2nd run 2023-09-23 20:22:52 +00:00

Okay I have implemented and pushed the changes that @dec05eba brought up, something like that is what I thought it might be.

I apparently completely forgot to also port xrRequestExitSession from the example at the time that I created this application...

@Kagukara thanks for your continued effort for testing. I haven't had the time so far to look in detail at your reports and because of @dec05eba comment I might not need too (sorry), please try those changes at your convenience :)

Okay I have implemented and pushed the changes that @dec05eba brought up, something like that is what I thought it might be. I apparently completely forgot to also port `xrRequestExitSession` from the example at the time that I created this application... @Kagukara thanks for your continued effort for testing. I haven't had the time so far to look in detail at your reports and because of @dec05eba comment I might not need too (sorry), please try those changes at your convenience :)

The segfault is no longer appearing.

I can type xr-video-player --video ~/videos/VR/playlist.m3u into the terminal to play the video and see it within the VR Headset. Will make a new issue if anything else goes wrong/request a functionality.

To close xr-video-player --video ~/videos/VR/playlist.m3u when pressing either "Esc" on the window or "ctrl+c" it shows Requesting exit.. in the terminal and the window is closed, but still active in the terminal until its killed inside btop. Once killed in btop it outputs Killed in the terminal and is no longer active.

Typing xr-video-player --video ~/videos/VR/playlist.m3u again (which didn't work before) now works with no segfault appearing.

To close xr-video-player --video ~/videos/VR/playlist.m3u when pressing either "Esc" on the window or "ctrl+c" it shows Requesting exit.. in the terminal and the window is closed, but still active in the terminal until its killed inside btop. Once killed in btop it outputs Killed in the terminal and is no longer active.

This happens in gdb as well.
Output before killed in btop: https://hastebin.com/share/rugusumevo.yaml
After killed in btop it then shows:

Killed

EDIT or it shows:

Program terminated with signal SIGKILL, Killed.
The program no longer exists.
(gdb) exit
### **The segfault is no longer appearing.** I can type `xr-video-player --video ~/videos/VR/playlist.m3u` into the terminal to play the video and see it within the VR Headset. Will make a new issue if anything else goes wrong/request a functionality. To close `xr-video-player --video ~/videos/VR/playlist.m3u` when pressing either "Esc" on the window or "ctrl+c" it shows `Requesting exit..` in the terminal and the window is closed, but still active in the terminal until its killed inside `btop`. Once killed in `btop` it outputs `Killed` in the terminal and is no longer active. Typing `xr-video-player --video ~/videos/VR/playlist.m3u` again (which didn't work before) now works with no segfault appearing. # >To close `xr-video-player --video ~/videos/VR/playlist.m3u` when pressing either "Esc" on the window or "ctrl+c" it shows `Requesting exit..` in the terminal and the window is closed, but still active in the terminal until its killed inside `btop`. Once killed in `btop` it outputs `Killed` in the terminal and is no longer active. This happens in `gdb` as well. Output before killed in `btop`: [https://hastebin.com/share/rugusumevo.yaml](https://hastebin.com/share/rugusumevo.yaml) After killed in btop it then shows: ``` Killed ``` EDIT or it shows: ``` Program terminated with signal SIGKILL, Killed. The program no longer exists. (gdb) exit ```
Collaborator

Maybe xrDestroyInstance is needed as well? it's not clear from the documentation

Maybe xrDestroyInstance is needed as well? it's not clear from the documentation

Spoke too soon that the segfault is no longer appearing.

Steps I did to reproduce:

  1. Type in xr-video-player --video ~/location/to/video
  2. Kill xr-video-player in btop
  3. Type in xr-video-player --video ~/location/to/video
    • Segfault appears
    • If segfault didn't appear repeat steps 1-3 until it does
      • Usually its the 2nd time, but can happen after +3 times.

Segfault inside gdb:

Thread 19 "xr-video-player" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffa57ff6c0 (LWP 42470)]
0x00007fffe2468288 in LfMutexUnlockRobust(LfMutex*) () from /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so
(gdb) backtrace
#0  0x00007fffe2468288 in LfMutexUnlockRobust(LfMutex*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so
#1  0x00007fffe23af41a in CSyncLockThread::Run() () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so
#2  0x00007fffe2446219 in CThread::ThreadProc(void*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so
#3  0x00007ffff6eaa9eb in start_thread (arg=<optimized out>) at pthread_create.c:444
#4  0x00007ffff6f2e71c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
(gdb) list
                                                                                                                                                                                  1	/usr/src/debug/glibc/glibc/nptl/<built-in>: Bad file descriptor.

xr-video-player window is still open and black, also black in the VR Headset.

Unrelated to steps, but I managed to get this segfault as well in gdb:

Thread 19 "xr-video-player" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffa587f6c0 (LWP 37966)]
0x00007fffe2468288 in LfMutexUnlockRobust(LfMutex*) ()
   from /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so
(gdb) backtrace
#0  0x00007fffe2468288 in LfMutexUnlockRobust(LfMutex*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so
#1  0x00007fffe23af41a in CSyncLockThread::Run() () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so
#2  0x00007fffe2446219 in CThread::ThreadProc(void*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so
#3  0x00007ffff6eaa9eb in start_thread (arg=<optimized out>) at pthread_create.c:444
#4  0x00007ffff6f2e71c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
(gdb) list
Downloading source file /usr/src/debug/glibc/glibc/nptl/<built-in>
1	/usr/src/debug/glibc/glibc/nptl/<built-in>: Directory not empty.

xr-video-player window is still open and black, also black in the VR Headset.

Spoke too soon that the segfault is no longer appearing. Steps I did to reproduce: 1. Type in `xr-video-player --video ~/location/to/video` 2. Kill `xr-video-player` in `btop` 3. Type in `xr-video-player --video ~/location/to/video` - Segfault appears - If segfault didn't appear repeat steps 1-3 until it does - Usually its the 2nd time, but can happen after +3 times. Segfault inside `gdb`: ``` Thread 19 "xr-video-player" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffa57ff6c0 (LWP 42470)] 0x00007fffe2468288 in LfMutexUnlockRobust(LfMutex*) () from /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so (gdb) backtrace #0 0x00007fffe2468288 in LfMutexUnlockRobust(LfMutex*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so #1 0x00007fffe23af41a in CSyncLockThread::Run() () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so #2 0x00007fffe2446219 in CThread::ThreadProc(void*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so #3 0x00007ffff6eaa9eb in start_thread (arg=<optimized out>) at pthread_create.c:444 #4 0x00007ffff6f2e71c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78 (gdb) list 1 /usr/src/debug/glibc/glibc/nptl/<built-in>: Bad file descriptor. ``` `xr-video-player` window is still open and black, also black in the VR Headset. # Unrelated to steps, but I managed to get this segfault as well in `gdb`: ``` Thread 19 "xr-video-player" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffa587f6c0 (LWP 37966)] 0x00007fffe2468288 in LfMutexUnlockRobust(LfMutex*) () from /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so (gdb) backtrace #0 0x00007fffe2468288 in LfMutexUnlockRobust(LfMutex*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so #1 0x00007fffe23af41a in CSyncLockThread::Run() () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so #2 0x00007fffe2446219 in CThread::ThreadProc(void*) () at /opt/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so #3 0x00007ffff6eaa9eb in start_thread (arg=<optimized out>) at pthread_create.c:444 #4 0x00007ffff6f2e71c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78 (gdb) list Downloading source file /usr/src/debug/glibc/glibc/nptl/<built-in> 1 /usr/src/debug/glibc/glibc/nptl/<built-in>: Directory not empty. ``` `xr-video-player` window is still open and black, also black in the VR Headset.

I assume btop sends a SIGKILL signal to xr-video-player. If such is true then I can not handle the signal at all ... so no clean shutdown via xrRequestExitSession which then makes SteamVR unhappy for successive starts.

(based upon my reading of https://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html#index-SIGKILL)

Output before killed in btop: https://hastebin.com/share/rugusumevo.yaml

The reason for the application not to shutdown by itself, is probably because of one [New Thread 0x7fff237fe6c0 (LWP 21086)] that is started but not exited... With monado such does not happen, so I think SteamVR is the problem ...

I am going to think a bit more about it, but currently I don't have another idea ...

I assume `btop` sends a `SIGKILL` signal to `xr-video-player`. If such is true then I can not handle the signal at all ... so no clean shutdown via `xrRequestExitSession` which then makes SteamVR unhappy for successive starts. (based upon my reading of https://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html#index-SIGKILL) > Output before killed in btop: https://hastebin.com/share/rugusumevo.yaml The reason for the application not to shutdown by itself, is probably because of one` [New Thread 0x7fff237fe6c0 (LWP 21086)]` that is started but not exited... With monado such does not happen, so I think SteamVR is the problem ... I am going to think a bit more about it, but currently I don't have another idea ...

@Kagukara I found ValveSoftware/SteamVR-for-Linux#422 and ValveSoftware/SteamVR-for-Linux#479

Issue 422 matches this:

To close xr-video-player --video ~/videos/VR/playlist.m3u when pressing either "Esc" on the window or "ctrl+c" it shows Requesting exit.. in the terminal and the window is closed, but still active in the terminal until its killed inside btop. Once killed in btop it outputs Killed in the terminal and is no longer active.

And 479 matches the segfault backtrace that you reported last.

There are also a bunch of other projects that mention this problem in the issues. It seams like there is nothing that can be done from our side.

If you want, you can add a comment to Valve's issues, mentioning that this project is also affected and that you are interested in a resolution ... no idea if that helps though. One of the issues is close to its second anniversary and the other is already over ... If SteamVR were opensource, a PR would have surly by now been merged, fixing the problem ;)

@Kagukara I found [ValveSoftware/SteamVR-for-Linux#422](https://github.com/ValveSoftware/SteamVR-for-Linux/issues/422) and [ValveSoftware/SteamVR-for-Linux#479](https://github.com/ValveSoftware/SteamVR-for-Linux/issues/479) Issue 422 matches this: > To close `xr-video-player --video ~/videos/VR/playlist.m3u` when pressing either "Esc" on the window or "ctrl+c" it shows `Requesting exit..` in the terminal and the window is closed, but still active in the terminal until its killed inside `btop`. Once killed in `btop` it outputs `Killed` in the terminal and is no longer active. And 479 matches the segfault backtrace that you reported last. There are also a bunch of other projects that mention this problem in the issues. It seams like there is nothing that can be done from our side. If you want, you can add a comment to Valve's issues, mentioning that this project is also affected and that you are interested in a resolution ... no idea if that helps though. One of the issues is close to its second anniversary and the other is already over ... If SteamVR were opensource, a PR would have surly by now been merged, fixing the problem ;)

I'll go link this on the two issue pages. Thank you for your time and getting to the cause of the issue.

I'll go link this on the two issue pages. Thank you for your time and getting to the cause of the issue.
Sign in to join this conversation.
There is no content yet.