Skip to content

Fix libusb threads when backgrounded#3437

Draft
dougnazar wants to merge 2 commits into
networkupstools:masterfrom
dougnazar:fix_libusb_threads_when_backgrounded
Draft

Fix libusb threads when backgrounded#3437
dougnazar wants to merge 2 commits into
networkupstools:masterfrom
dougnazar:fix_libusb_threads_when_backgrounded

Conversation

@dougnazar
Copy link
Copy Markdown
Contributor

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 and is delayed until it switches to SIGKILL.

Stopping /run/nut/usbhid-ups-xxxx.pid failed, retrying harder: Success

I 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-hid driver.

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?

dougnazar added 2 commits May 12, 2026 17:12
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>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

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.

@AppVeyorBot
Copy link
Copy Markdown

Build nut 2.8.5.4708-master completed (commit 11c4a94a6a by @dougnazar)

@AppVeyorBot
Copy link
Copy Markdown

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

Successfully merging this pull request may close these issues.

2 participants