fix(manager): survive a dropped pad path; keep the monitor alive#7
Merged
Conversation
During a disconnect/reconnect of all pads, _refresh_nodes drops an instance's path to None when the pad does not re-enumerate in time. The resting-colour watch then called hidraw_for_event(None), which raised TypeError — and _monitor had no guard around _poll, so that single exception killed the monitor thread for good: hotplug adoption, removal and LED updates all stopped silently while the D-Bus main loop kept answering menu clicks (modes still switched, nothing else updated). - hidraw_for_event tolerates a None/empty path (returns []), matching led_indicator_for_event, whose callers already accept None. - _monitor wraps _poll in try/except: log the traceback and keep polling so one transient error can never freeze the daemon again.
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.
Problem
During a disconnect/reconnect of all pads,
_refresh_nodesdrops an instance'spathtoNonewhen the pad does not re-enumerate in time. The resting-colour watch then callshidraw_for_event(None), which raisedTypeError: expected str … not NoneType.Worse,
_monitorhad no guard around_poll(), so that single exception killed the monitor thread for good: hotplug adoption, removal and LED updates all stopped silently while the D-Bus main loop kept answering menu clicks — the tray looked alive but never updated again (observed in the field 2026-07-15).Fix
hidraw_for_eventtolerates aNone/empty path (returns[]), matchingled_indicator_for_event, whose callers already acceptNone._monitorwraps_pollintry/except: log the traceback and keep polling, so one transient error can never freeze the daemon again.Tests
New
tests/test_monitor_resilience.py: exercises the realhidraw_for_event(None), aps5-nativeinstance whose path wentNonesurviving_apply_led/watch_holders, and_monitorcontinuing to poll after a raising_poll(). Full suite green.