Repository navigation
fix(nodes): prevent startup failure when a node is unreachable - #1085
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Heartbeat cancellation and lease release app/node/bridge.py |
The bridge imports LifecycleLease and LifecycleStatus. Its release override cancels and awaits the heartbeat task, then calls the base release method with the observed and desired statuses and version values. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: drsaeedhub
Merge Risk: 
Minimal · up to cd327
-
No actionable merge-blocking risk is identified for this lifecycle-release change.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Linked Issues check
-
Explanation
Issue [
#1083] requires an unreachable node to not abort panel startup and to preserve normal node error handling. The PR overrides_release_lifecycle_leaseinapp/node/bridge.py, cancels and drains the bridge heartbeat withasyncio.gather(..., return_exceptions=True), then delegates lifecycle release. The reported gRPC fault injection records the affected node asError, and the reported checks cover both gRPC and REST, delayed failures, and caller cancellation. The reported existing suite passed 65 tests, and eight external regression checks passed.
Full details: Out of Scope Changes check
-
Explanation
The whole-PR diff changes only
app/node/bridge.py. The import and_release_lifecycle_leaseoverride directly address the heartbeat cleanup that masks node connection errors. No unrelated production behavior, dependency change, schema change, or unrelated test change is present.
-
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- 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.
A rabbit watched the heartbeat glow,
Then paused its thump before release.
The lease received its status notes,
Its version values tucked in place.
The carrot queue now rests in peace.
Comment @coderabbitai help to get the list of available commands.
|
@coderabbitai review |
✅ Action performed
|
… does not raise CancelledError RED on b8e5a6d61 with bridge 0.9.2+singbox: 2 failed, 1 passed (the caller-cancellation guard). Bridge 0.9.2 awaits the cancelled heartbeat directly, the same bug upstream 663a57e (PasarGuard#1085) works around for 0.9.4.
…rd#978 and PasarGuard#1085 as ported by their B-NODE cherry-picks and take them off the port queue
Summary
An immediate node connection failure can abort panel startup in v5.5.0: bridge 0.9.4 cancels its lifecycle heartbeat before the task starts, then directly awaiting it replaces the original
NodeAPIErrorwithCancelledError.Drain the heartbeat with
asyncio.gather(..., return_exceptions=True)in the shared panel adapter before delegating lifecycle state release to the bridge. Both gRPC and REST retain normal node error handling, and cancellation of the calling task still propagates.Fixes #1083.
Type of change
Checklist
Testing
pytest tests/test_node_bridge.py tests/test_node_reconnect_recovery.py tests/test_node_start_timeout.py -q— 65 passed.OSError(101, "Network is unreachable"): baseline reproducesOSError -> NodeAPIError -> CancelledError; patched startup succeeds and records the node asError. Delayed failure also remains handled.git diff --checkpassed.Screenshots
Not applicable.
Notes for reviewers
Only
app/node/bridge.pychanges. The adapter works around bridge 0.9.4 cleanup without changing the dependency or suppressing application shutdown cancellation. Validation used controlled transport failures, not a full Docker deployment.Summary by CodeRabbit