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

Crash on USB3.1 Port, but works in USB3.0 Port (libinput usbi_mutex_lock assertion failed) #278

Open
edgar444 opened this issue Jul 22, 2022 · 1 comment

Comments

@edgar444
Copy link

Describe the bug
Pluging into USB3.1 port crashes libsurvive, repluging into USB3.0 works. Specifically it is libusb assert. This could be forwarded to libusb or kernel, idk.

Data
Output (colored in attachment):

$ survive-cli
Info: Loaded drivers: GlobalSceneSolver, HTCVive
Info: Adding tracked object T20 from HTC
Info: Device T20 has watchman FW version 1623823641 and FPGA version 538/9/2; named '                   WMBUILD-W64$'. Hardware id 0x22154109 Board rev: 3 (len 56)
Info: T20 is treated as HMD device
Warning: 3.207973 T20 Device disconnect: 1
survive-cli: /tmp/portage/portage/dev-libs/libusb-1.0.26/work/libusb-1.0.26/libusb/os/threads_posix.h:46: usbi_mutex_lock: Assertion `pthread_mutex_lock(mutex) == 0' failed.
Aborted (core dumped)

Backtrace (colored in attachment):

(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007f975bdb58af in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007f975bd69a52 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007f975bd54469 in __GI_abort () at abort.c:79
#4  0x00007f975bd54395 in __assert_fail_base (fmt=<optimized out>, assertion=<optimized out>, file=<optimized out>, line=<optimized out>, function=<optimized out>) at assert.c:92
#5  0x00007f975bd62ae2 in __GI___assert_fail (assertion=assertion@entry=0x7f975bd21060 "pthread_mutex_lock(mutex) == 0",
    file=file@entry=0x7f975bd21000 "/tmp/portage/portage/dev-libs/libusb-1.0.26/work/libusb-1.0.26/libusb/os/threads_posix.h", line=line@entry=46,
    function=function@entry=0x7f975bd25be0 <__PRETTY_FUNCTION__.38> "usbi_mutex_lock") at assert.c:101
#6  0x00007f975bd1cb83 in usbi_mutex_lock (mutex=<optimized out>) at /usr/src/debug/dev-libs/libusb-1.0.26/libusb-1.0.26/libusb/os/threads_posix.h:46
#7  0x00007f975bd1f60d in usbi_mutex_lock (mutex=<optimized out>) at /usr/src/debug/dev-libs/libusb-1.0.26/libusb-1.0.26/libusb/os/linux_usbfs.c:2689
#8  handle_iso_completion (urb=<optimized out>, itransfer=<optimized out>) at /usr/src/debug/dev-libs/libusb-1.0.26/libusb-1.0.26/libusb/os/linux_usbfs.c:2482
#9  reap_for_handle (handle=handle@entry=0x55bbae189b50) at /usr/src/debug/dev-libs/libusb-1.0.26/libusb-1.0.26/libusb/os/linux_usbfs.c:2678
#10 0x00007f975bd200a2 in op_handle_events (ctx=0x55bbae14e340, event_data=0x55bbae15ef50, count=3, num_ready=0) at /usr/src/debug/dev-libs/libusb-1.0.26/libusb-1.0.26/libusb/os/linux_usbfs.c:2748
#11 0x00007f975bd1883a in handle_events (ctx=ctx@entry=0x55bbae14e340, tv=tv@entry=0x7ffebe7a1220) at /usr/src/debug/dev-libs/libusb-1.0.26/libusb-1.0.26/libusb/io.c:2274
#12 0x00007f975bd19d78 in libusb_handle_events_timeout_completed (ctx=0x55bbae14e340, tv=tv@entry=0x7ffebe7a12e0, completed=completed@entry=0x0) at /usr/src/debug/dev-libs/libusb-1.0.26/libusb-1.0.26/libusb/io.c:2361
#13 0x00007f975bd19da7 in libusb_handle_events_timeout (ctx=<optimized out>, tv=tv@entry=0x7ffebe7a12e0) at /usr/src/debug/dev-libs/libusb-1.0.26/libusb-1.0.26/libusb/io.c:2414
#14 0x00007f975c2ab638 in survive_vive_usb_poll (ctx=0x55bbae12c650, v=0x55bbae131240) at /mnt/Zippy/tmp/workspace/home/vr/libsurvive/src/driver_vive.c:1038
#15 0x00007f975c2e1d5e in survive_poll (ctx=ctx@entry=0x55bbae12c650) at /mnt/Zippy/tmp/workspace/home/vr/libsurvive/src/survive.c:1107
#16 0x000055bbadc89275 in main (argc=<optimized out>, argv=0x7ffebe7a1ce8) at /mnt/Zippy/tmp/workspace/home/vr/libsurvive/survive-cli.c:40
(gdb)

Compile

master:4914ff787728dd055b315ff523a6060fb34df223
cmake -DCMAKE_INSTALL_PREFIX=$(realpath ../local) -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS_DEBUG=-ggdb3 -DCMAKE_C_FLAGS_DEBUG=-ggdb3 .

Hardware setup
Valve Index + 2x Base Station 2.0 (idle, though same assert when active)
Gigabyte Aorus X570 Elite with USB3.1 Port

Desktop:
Kernel: 5.18.12-gentoo
Other: dev-libs/libusb-1.0.26

Additional context
The logs are ANSI color-codes, use less -R to view or strip with awk '{gsub(/\033\[[0-9;]*m/, "")};1':
backtrace.ansi.txt
output.ansi.txt
output_with_libusb_debug.ansi.txt

If you need the .pcap, I might wireshark and filter out the relevant usb port, with lsusb info. At a later time.

@edgar444
Copy link
Author

Note, before this realization. It worked fine in Windows, so it shouldn't be fundamental to hardware or headset.

@edgar444 edgar444 changed the title Crash on USB3.1 Port, but works in USB3.0 Port Crash on USB3.1 Port, but works in USB3.0 Port (libinput usbi_mutex_lock assertion failed) Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant