Skip to content

power-policy-service: Shorten lock held in disconnect flow#813

Merged
RobertZ2011 merged 1 commit into
OpenDevicePartnership:mainfrom
RobertZ2011:power-policy-disconnect-dont-hold-lock
Apr 21, 2026
Merged

power-policy-service: Shorten lock held in disconnect flow#813
RobertZ2011 merged 1 commit into
OpenDevicePartnership:mainfrom
RobertZ2011:power-policy-disconnect-dont-hold-lock

Conversation

@RobertZ2011
Copy link
Copy Markdown
Contributor

This lock was being held for the duration of the conditional branch, causing a deadlock in update_current_consumer.

@RobertZ2011 RobertZ2011 self-assigned this Apr 21, 2026
This lock was being held for the duration of the conditional branch,
causing a deadlock in `update_current_consumer`.
@RobertZ2011 RobertZ2011 force-pushed the power-policy-disconnect-dont-hold-lock branch from 5b63c14 to 50405a2 Compare April 21, 2026 19:03
@RobertZ2011 RobertZ2011 marked this pull request as ready for review April 21, 2026 19:10
Copilot AI review requested due to automatic review settings April 21, 2026 19:10
@RobertZ2011 RobertZ2011 requested review from a team as code owners April 21, 2026 19:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the power-policy-service disconnect handling to avoid holding the internal mutex across async work, preventing a deadlock when update_current_consumer() is invoked during the disconnect flow.

Changes:

  • Refactor process_notify_disconnect to extract current_consumer_state under the mutex, then drop the lock before running the disconnect/update sequence.

Comment thread power-policy-service/src/lib.rs
@RobertZ2011 RobertZ2011 merged commit 1b6049c into OpenDevicePartnership:main Apr 21, 2026
19 checks passed
@RobertZ2011 RobertZ2011 deleted the power-policy-disconnect-dont-hold-lock branch April 21, 2026 20:02
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.

4 participants