Repository navigation
fix(linux): a service action through the helper waits up to 60 s, not the 10 s a read gets (#3029) - #3030
Merged
Conversation
… the 10 s a read gets (#3029) The helper waits up to 10 s for each state change around 2 s bus calls, and a restart is a stop and then a start, so a slow service outlasted PkexecBroker::CALL_TIMEOUT: the UI said the action failed though systemd carried it out, and the timeout ended the helper session. call() now waits SERVICE_ACTION_TIMEOUT for a ServiceActionRequest and CALL_TIMEOUT for anything else. Fixes #3029 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
mgradwohl
marked this pull request as ready for review
October 26, 2026 09:43
mgradwohl
enabled auto-merge (squash)
October 26, 2026 09:43
…ion (#3029) retried() asked the helper with an empty stop token, so with the 60 s wait a cancel, or closing TaskSmack, waited out the whole action. It now passes the action's token, and a stopped wait returns ServiceActionResult::stopRequested(), as runAuthorized() now does too. FakeBroker fails a call whose token is stopped with "cancelled", as PkexecBroker does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mgradwohl
disabled auto-merge
October 26, 2026 09:57
mgradwohl
enabled auto-merge (squash)
October 26, 2026 09:57
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.
Description
On Linux, a service action sent through tasksmack-helper had to finish within
PkexecBroker::CALL_TIMEOUT(10 s), the same limit as a read. The helper waits up toUnitWait::timeout(10 s) for each state change, with bus calls of up to 2 s around each wait, and a restart is a stop and then a start. So a slow service outlasted the 10 s:call()'scloseLocked()ended the helper session, so the next read or action asked for the password again.PkexecBroker::call()now waitsSERVICE_ACTION_TIMEOUT(60 s) for aServiceActionRequest, andCALL_TIMEOUT(10 s) for anything else. The newcallTimeoutFor()picks between them.callIfIdle()is unchanged.With the longer wait, a stop request has to reach the call.
BrokeredServiceActions::retried()asked the helper with an emptystd::stop_token{}, so a cancel, or closing TaskSmack, waited out the whole action. It now passes the action's token. A stopped wait returnsServiceActionResult::stopRequested(), inretried()and inrunAuthorized().FakeBrokerfails a call whose token is stopped with "cancelled", asPkexecBrokerdoes.Windows is unaffected: service actions don't go through its helper.
Fixes #3029
PR Size
Small: 6 files, about 90 lines.
Type of Change
Checklist
clang-tidyand addressed any warningsclang-formaton my changespre-commit run --all-filesor installed pre-commit hooksTesting
PkexecBrokerTest.AServiceActionWaitsLongerThanTheHelperCanTakederives the helper's worst case fromSystemdBus::UnitWaitandSystemdBus::CALL_TIMEOUT_USEC: two state changes, each a wait plus four bus calls. It checks that a restart's timeout is longer than that, and that other requests keepCALL_TIMEOUT. If either constant grows past the client's wait, the test fails.BrokeredServiceActionsTest.AStopRequestEndsTheWaitForTheHelperchecks that a stopped token reaches the helper's call and comes back as a cancelled result, fromrestart()and fromrunAuthorized().Additional Notes
Found in a review of the #2728 helper PRs (#3002, #3013). The mutex is held for the longer wait, so a process action queued behind a slow service action waits too, and the sampler's
callIfIdle()reads report "busy" and skip that refresh, as they already do behind any call.🤖 Generated with Claude Code