Skip to content

test: tolerate closed sockets in lease policy proxy - #364

Merged
thweetkomputer merged 1 commit into
mainfrom
fix/ci-proxy-lifecycle
Oct 20, 2026
Merged

thweetkomputer merged 1 commit into
mainfrom
fix/ci-proxy-lifecycle

Conversation

@thweetkomputer

Copy link
Copy Markdown
Collaborator

Context

ARM64 shard 3 failed in gate_lease_policy with ValueError('file descriptor cannot be a negative integer (-1)'). The opposite proxy pump can close both sockets before the policy pump calls select.

Behavior before and after

Expected connection teardown previously entered proxy.errors and failed the gate after its lease checks succeeded. The policy pump now exits normally when select raises ValueError and its source socket is closed.

Implementation

Catch ValueError only around select, check the source descriptor, and re-raise if it is still open. Keep the existing final pair cleanup.

Design decisions and alternatives

Checking before select would leave a close-between-check-and-use race. Catching every ValueError across the pump would hide unrelated failures.

Documentation and comments

Document the shared-socket teardown race next to the handler. No architecture change: this only repairs the test proxy.

Test plan

  • LAVIK_TEST_DATA_DIR=/mnt/dev ctest --test-dir build_ci -R '^meta_integration\.gate_lease_policy$' --repeat until-fail:3 --output-on-failure — all three runs passed (37.93, 36.23, and 35.79 seconds).
  • Local socket-pair probes: closed-socket teardown succeeds; an injected ValueError with an open descriptor remains an error; malformed control frames still fail.
  • pre-commit run --files tests/meta_integration/gate_lease_policy.py — passed.
  • git diff --check — passed.

Risk assessment

Test-only change. Error suppression is limited to select on a closed source socket.

Rollback plan

Revert this commit.

Reviewer guide

Review the local select handler in PolicyBarrier._pump.

Follow-up work

None.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 44 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a7bf27ae-428d-4851-b365-a2419a8705f7
📥 Commits

Reviewing files that changed from the base of the PR and between 2d8a293 and 5561be2.

📒 Files selected for processing: 1
  • tests/meta_integration/gate_lease_policy.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@thweetkomputer
thweetkomputer merged commit 7ef96dd into main Oct 20, 2026
6 checks passed
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.

1 participant