Fix libusb threads when backgrounded#3437
Draft
dougnazar wants to merge 2 commits into
Draft
Conversation
Signed-off-by: Doug Nazar <nazard@nazar.ca>
This is needed in particular with libusb on linux as it will create a thread to handle either netlink or udev messages. If this is created before we background, the driver will hang during exit trying to join the non-existant thread in the new process. Shows this warning while stopping the driver. Stopping /run/nut/usbhid-ups-xxxx.pid failed, retrying harder: Success Signed-off-by: Doug Nazar <nazard@nazar.ca>
|
A ZIP file with standard source tarball and another tarball with pre-built docs for commit f7ba488 is temporarily available: NUT-tarballs-PR-3437.zip. |
|
✅ Build nut 2.8.5.4708-master completed (commit 11c4a94a6a by @dougnazar)
|
|
✅ Build nut 2.8.5.4708-master completed (commit 11c4a94a6a by @dougnazar) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is needed in particular with
libusbon linux as it will createa thread to handle either
netlinkorudevmessages. If this is createdbefore we background, the driver will hang during exit trying to join
the non-existant thread in the new process. Shows this warning while
stopping the driver and is delayed until it switches to
SIGKILL.Stopping /run/nut/usbhid-ups-xxxx.pid failed, retrying harder: SuccessI picked closing and then re-opening as the simpler to implement & test,
but has the biggest impact on each driver. Quite possibly some/all might
need to be modified to allow re-opening like the
usb-hiddriver.The other option I considered was breaking up the backgrounding into stages,
creating the background process early, but leaving the forground process
running to report startup messages until initialization is finished.
Or perhaps there is another option?