-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
hotplugtest crash when unplug an external USB hub under macOS #1445
Comments
From here If I just unplug the attached USB device on the external HUB, then no issues. The following is with git main without any extra patches.
The issue only appears if I unplug the external hub.
|
On the other hand, this is not a regression as it is also present in libusb-1.0.26 release. So this is not a release blocker for 1.0.27 release. |
Unfortunately it does not help.
Debug log for segfault when unplug an external HUB under macOS
|
The following test is using @sonatique's Windows hotplug branch. Build option -- with Apple Clang Address Scan.
Mac Mini M1 --> 7-ports powered USB 3.0 Hub --> 13 ports powered USB 2.0 Hub
BTW, the branch has no issues with
|
git main (same as 1.0.27 release) results are the same. Unplug --> Segfault; Plug --> no issues
|
@mcuee could you repeat the experiment with the last instrumented code of e393d8e that I mentioned here: #1406 (comment) printf are in the common hotplug code that is used by Darwin as well, so it might help understanding. Thanks. |
It does not seem to crash with your debug branch. There are a few warnings when building under Apple macOS (note: with AScan,
Run log.
|
Maybe you find a fix for this issue. Nice. Your branch does not have the issue mentioned here. Full debug log under macOS 14.3 (Mac Mini M1 2020) no more crashes under macOS 14.3 when removing the external hub
|
More tests with four layer of USB hubs (total 15 USB devices). Mac Mini M1 --> Ugreen USB Type-C hub --> 7 ports powered USB 3.0 hub --> 13 ports powered USB 2.0 hub --> Ugreen 2.0 USB hub with 100Mbps Ethernet port.
|
The above log is with AScan. The following is with TScan,
|
@mcuee : that is interesting. I pushed a little fix along the way in my debug branch (added the lock to prevent background hot plug thread to concurrently modify device list during exit, previously talked about in windows hotplug branch). This is probably what helps. I will look a logs into details later, thanks. |
@seanm and @tormodvolden Maybe you are also interested in taking a look at the branch here, since it seems to fix this issue (maybe a surgical fix). |
Isn't this what is in PR #1452? |
@tormodvolden : let me explain: What @mcuee is referring to is not yet in #1452 . It happens that I made a special debug commit with lots of printf for debugging the remaining seg fault @mcuee is experiencing with my Windows hotplug implementation. |
@tormodvolden the fix is now included in #1452 |
Thanks. I will test #1452 this evening or tomorrow. |
Yes PR #1452 is good to fix the issue. Mac Mini M1 --> 7 ports powered USB 3.0 hub --> 13 ports powered USB 2.0 hub Unplug and plug the 7-ports USB 3.0 hub --> no longer crashes.
Detailed debug log for unplug and plug.
|
BTW, the Windows hotplug commit is also good under macOS.
|
Adding the Dell Thunberbolt Dock to the test, using git 02a1457 Mac Mini M1 -- Dell Dock -- 7-Port USB 3.0 Powered Hub -- 13-Port USB 2.0 Powered Hub
|
Latest PR #1452 git is also fine. |
Just a note: The crash is not due to the unplug event alone, but because hotplugtest at the same time is calling libusb_exit immediately after seeing the unplug event. So I suppose it only appears when leaving the loop in hotplugtest.c. |
Yes, you can see in my test I increase the number 2 to the number of devices being plugged out or plugged in (the USB hub and the devices connected to the hub). |
Yes, but if you raise the number to something much higher, so that it doesn't exit, you don't see the crash appearing, right? |
From here:
Initially no USB devices were attached. Then I pluged in the USB hub (with one USB device attached), then I unpluged the USB hub, which would casue the crash.
The text was updated successfully, but these errors were encountered: