Skip to content

Fix periodic check deadlock on incoming channel#116

Open
lestrrat wants to merge 5 commits intov3from
fix-periodic-check-deadlock
Open

Fix periodic check deadlock on incoming channel#116
lestrrat wants to merge 5 commits intov3from
fix-periodic-check-deadlock

Conversation

@lestrrat
Copy link
Collaborator

Fixes #113

Decouple item dispatch from periodicCheck to break circular wait between c.outgoing and c.incoming.

Copy link

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 fixes the controller/worker circular wait reported in issue #113 by decoupling periodic refresh selection from dispatch, allowing the controller to keep draining c.incoming while dispatching work.

Changes:

  • Refactors ctrlBackend.loop / periodicCheck so periodic checks return a dispatch queue that is drained while still servicing c.incoming.
  • Removes the old sendWorker helper and moves “mark busy” into periodicCheck.
  • Adds a regression test that reproduces the deadlock scenario and verifies Add() completes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
backend.go Splits periodic check “select due work” from dispatch to avoid circular channel backpressure deadlock.
httprc_test.go Adds a regression test for the periodic-check deadlock scenario described in issue #113.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

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.

Periodic check may cause deadlock

2 participants