fix(bonjour): prevent crash from unhandled ciao rejection during advertiser restart#77768
Open
Bartok9 wants to merge 1 commit intoopenclaw:mainfrom
Open
fix(bonjour): prevent crash from unhandled ciao rejection during advertiser restart#77768Bartok9 wants to merge 1 commit intoopenclaw:mainfrom
Bartok9 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
…rtiser restart When the bonjour watchdog detected a stuck probing state and called recreateAdvertiser(), the old cycle's unhandled-rejection handler was removed in stopCycle()'s finally block before the new cycle registered its own handler. This left a timing window where ciao's internally- scheduled probe timers could fire a "CIAO PROBING CANCELLED" rejection with no handler active, crashing the gateway. Fix: register the ciao rejection handler once at the outer startGateway- BonjourAdvertiser scope instead of per-cycle. The handler now persists across cycle recreations and is only cleaned up on final stop(). Fixes openclaw#77734
Contributor
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(bonjour): prevent crash from unhandled ciao rejection during advertiser restart This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Contributor
Author
|
CI note: The failing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the gateway crashing when the bonjour watchdog detects a stuck probing state and recreates the advertiser. The unhandled rejection handler was temporarily removed during the recreation gap.
Root Cause
When
recreateAdvertiser()was called:stopCycle(previous)destroyed services and shut down the responderfinallyblock,stopCyclecalledcycle.cleanupUnhandledRejection()— removing the ciao rejection handlercreateCycle()then registered a new handlerBetween steps 2 and 3, if ciao's internally-scheduled probe retry timer fired (2-second intervals), the "CIAO PROBING CANCELLED" rejection went unhandled and crashed the process.
Fix
Hoist the unhandled rejection handler registration to the outer
startGatewayBonjourAdvertiserscope. The handler now:stop()Changes
src/infra/bonjour.ts: Move handler registration out ofcreateCycle()to the enclosing function scope. Remove the now-unusedcleanupUnhandledRejectionfield fromBonjourCycle. Clean up the handler instop()instead.CHANGELOG.md: Fix entry.Real behavior proof
Ciao assertion handling also active in same environment (confirms ciao rejections fire in production):
Gateway process remained alive through all recreations — no unhandled rejection crashes. Process uptime confirmed via
openclaw gateway status.Fixes #77734