-
Notifications
You must be signed in to change notification settings - Fork 14
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
daemon crash on subsequent joystick reconnections #43
Comments
I'd have to check why this is happening, and I don't have access to my joystick right now, so I can't reproduce this at home. Can you enable trace logging and capture the logs? You should be able to do this by running the daemon with the |
Sure, here is the log (I'm made 2-3 joystick plugin/plugouts): |
It seems like the hotplug API in libusb is not working as I expected - the idea is that the hotplug mechanism should initiate a callback to close the connection if the device has been disconnected. Based on the logs, it seems like the hotplug mechanism doesn't quite do that, or I've borked up the hotplug callback implementation in libx52. |
libusb requires the application to call one of the `libusb_handle_events` functions in order for hotplug events to actually get dispatched. We don't need to wait for any timeout, so we use a default timeout of 0, which should process any pending events, and then return immediately. A test of repeatedly disconnecting and reconnecting a virtual device using USBIP was done, and no crashes of the daemon were observed. Github-Issue: #43
I've pushed a change that should fix this issue - can you please build the |
Just tested the daemon - reconnected the device several times, no crashes observed. Here is the log from journalctl:
Aug 07 18:58:22 flatbox.home x52d[276324]: INFO: x52d_device.c:73 Initializing libx52
Aug 07 18:58:22 flatbox.home x52d[276324]: INFO: x52d_device.c:35 Starting X52 device manager thread
Aug 07 18:58:22 flatbox.home x52d[276324]: INFO: x52d_clock.c:170 Starting X52 clock manager thread
Aug 07 18:58:22 flatbox.home x52d[276324]: INFO: x52d_command.c:579 Starting command processing thread
Aug 07 18:58:27 flatbox.home x52d[276324]: libusb: error [op_handle_events] cannot find handle for fd 7
Aug 07 18:58:27 flatbox.home x52d[276324]: libusb: error [udev_hotplug_event] ignoring udev action change
Aug 07 18:58:32 flatbox.home x52d[276324]: libusb: error [udev_hotplug_event] ignoring udev action change
Aug 07 18:58:37 flatbox.home x52d[276324]: INFO: x52d_device.c:51 Device connected, writing configuration
Aug 07 18:59:12 flatbox.home x52d[276324]: libusb: error [udev_hotplug_event] ignoring udev action change
Aug 07 18:59:14 flatbox.home x52d[276324]: INFO: x52d_device.c:51 Device connected, writing configuration
Aug 07 18:59:17 flatbox.home x52d[276324]: libusb: error [op_handle_events] cannot find handle for fd 7
Aug 07 18:59:24 flatbox.home x52d[276324]: libusb: error [udev_hotplug_event] ignoring udev action change
Aug 07 18:59:27 flatbox.home x52d[276324]: INFO: x52d_device.c:51 Device connected, writing configuration
Aug 07 18:59:33 flatbox.home x52d[276324]: libusb: error [op_handle_events] cannot find handle for fd 7
Aug 07 18:59:41 flatbox.home x52d[276324]: libusb: error [udev_hotplug_event] ignoring udev action change
Aug 07 18:59:43 flatbox.home x52d[276324]: INFO: x52d_device.c:51 Device connected, writing configuration
Aug 07 19:00:01 flatbox.home x52d[276324]: libusb: error [udev_hotplug_event] ignoring udev action change
Aug 07 19:00:03 flatbox.home x52d[276324]: INFO: x52d_device.c:51 Device connected, writing configuration
…--
Sent with Tutanota, https://tutanota.com
Aug 7, 2022, 02:54 by ***@***.***:
I've pushed a change that should fix this issue - can you please checkout the > fix-hotplug> branch and let me know if you still see the problems?
—
Reply to this email directly, > view it on GitHub <#43 (comment)>> , or > unsubscribe <https://github.com/notifications/unsubscribe-auth/AKK6VUWAIS7A4PWMSTGTLGTVX33LNANCNFSM5WT5KXTQ>> .
You are receiving this because you authored the thread.> Message ID: > <nirenjan/libx52/issues/43/1207299838> @> github> .> com>
|
Thank you for testing this, I will merge it to |
x52d daemon coredumps on subsequent physical joystick reconnections
Diagnostics below:
journalctl -xu x52d
May 22 17:07:31 flatbox.home x52d[1703]: INFO: x52d_device.c:73 Initializing libx52
May 22 17:07:31 flatbox.home x52d[1703]: INFO: x52d_device.c:35 Starting X52 device manager thread
May 22 17:07:31 flatbox.home x52d[1703]: INFO: x52d_clock.c:170 Starting X52 clock manager thread
May 22 17:31:46 flatbox.home x52d[1703]: libusb: error [udev_hotplug_event] ignoring udev action change
May 22 17:31:51 flatbox.home x52d[1703]: INFO: x52d_device.c:51 Device connected, writing configuration
May 22 21:59:45 flatbox.home x52d[1703]: libusb: error [udev_hotplug_event] ignoring udev action change
May 22 21:59:51 flatbox.home x52d[1703]: INFO: x52d_device.c:51 Device connected, writing configuration
May 22 21:59:51 flatbox.home x52d[1703]: libusb: error [do_close] Device handle closed while transfer was still being processed, but the device is still connected as far as we know
May 22 21:59:51 flatbox.home x52d[1703]: libusb: error [do_close] A cancellation hasn't even been scheduled on the transfer for which the device is closing
May 22 21:59:51 flatbox.home systemd[1]: x52d.service: Main process exited, code=dumped, status=11/SEGV
coredumpctl debug
Command Line: /usr/local/bin/x52d -f -v
Executable: /usr/local/bin/x52d
Control Group: /system.slice/x52d.service
Unit: x52d.service
Slice: system.slice
Boot ID: 5b95a2343be14ea8bc1da55cd88710b7
Machine ID: e33d9124cc344be3a8d2422f1d6be8ba
Hostname: flatbox.home
Storage: /var/lib/systemd/coredump/core.x52d.0.5b95a2343be14ea8bc1da55cd88710b7.1703.1653245991000000.zst (present)
Disk Size: 67.6K
Message: Process 1703 (x52d) of user 0 dumped core.
GNU gdb (GDB) Fedora 11.2-2.fc35
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
https://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/bin/x52d...
[New LWP 1736]
[New LWP 1703]
[New LWP 1737]
[New LWP 1717]
warning: Section `.reg-xstate/1736' in core file too small.
This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.fedoraproject.org/
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/local/bin/x52d -f -v'.
Program terminated with signal SIGSEGV, Segmentation fault.
warning: Section `.reg-xstate/1736' in core file too small.
#0 usbi_handling_events (ctx=) at /usr/src/debug/libusb1-1.0.25-8.fc35.x86_64/libusb/libusbi.h:484
484 return usbi_tls_key_get(ctx->event_handling_key) != NULL;
[Current thread is 1 (Thread 0x7f98a8897640 (LWP 1736))]
The text was updated successfully, but these errors were encountered: