Skip to content

fix: honor cancellation when the result relay is blocked - #758

Open
root-Manas wants to merge 1 commit into
projectdiscovery:devfrom
root-Manas:fix/cancel-blocked-result-relay
Open

root-Manas wants to merge 1 commit into
projectdiscovery:devfrom
root-Manas:fix/cancel-blocked-result-relay

Conversation

@root-Manas

Copy link
Copy Markdown

When an SDK caller stops reading Service.Execute results and cancels its context, a relay blocked on the full output channel cannot exit. Its unconditional send also prevents the waiter from closing the result channel. Agents already use cancellation-aware sends, but the relay still needs the same handling.

Use the existing sources.SendResult helper for the relay. Regression tests exercise cancellation with both an unbuffered output and the default 32-result buffer, and verify that normal delivery preserves order, timestamps, and channel closure. Both cancellation cases fail on the unmodified dev implementation and pass with this change.

Related to #724; this addresses cancellation in the service relay after the producer-side changes.

Validation on Windows/amd64 with Go 1.27.0:

  • go test . -run TestExecute -count=20
  • go test ./...
  • go vet ./...
  • go build -o ../artifacts/uncover.exe ./cmd/uncover

Local race testing could not run because this environment has CGO disabled and no C compiler installed.

Copilot AI lite review requested due to automatic review settings September 27, 2026 04:33
@coderabbitai

coderabbitai Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 1fdf161b-5511-43e3-acf7-afbdcd7757a1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The reviewed changes address cancellation handling and include comprehensive regression coverage.

Review effort: Lite
Findings: None

What changed in this PR

Updates Service.Execute to honor context cancellation when result delivery is blocked.

Changes:

  • Uses sources.SendResult for cancellation-aware relay delivery.
  • Adds regression tests for buffered and unbuffered cancellation, ordering, timestamps, and closure.
File Description
uncover.go Makes relay output cancellation-aware.
uncover_test.go Adds cancellation and delivery behavior tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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