Skip to content

fix: bound hung broker connects instead of waiting forever - #773

Open
kevin9327 wants to merge 1 commit into
openai:mainfrom
kevin9327:fix/broker-connect-timeout
Open

kevin9327 wants to merge 1 commit into
openai:mainfrom
kevin9327:fix/broker-connect-timeout

Conversation

@kevin9327

Copy link
Copy Markdown

Problem

waitForBrokerEndpoint only resolved when a socket connected or errored. A named pipe or Unix socket that stayed in connecting state never tripped the 150ms/2s readiness budget, so ensureBrokerSession and later companion commands could hang indefinitely. Broker client initialize() had the same gap, and a timed-out connect was not retried on a direct app-server the way ENOENT/ECONNREFUSED already are.

Change

  • Bound each readiness probe attempt with a timer and destroy the socket on expiry.
  • Time out broker client connects after 2s with ETIMEDOUT.
  • Treat ETIMEDOUT as a retryable broker connection failure in withAppServer.

Test

waitForBrokerEndpoint returns false when connect hangs past the timeout hangs until the test runner timeout on main and passes after this change.

AI-assisted (Grok)

waitForBrokerEndpoint only resolved on connect or error, so a named
pipe or Unix socket that never completed left ensureBrokerSession and
later commands hung past their readiness budget. Time out each connect
attempt, apply the same deadline when opening a broker client, and
treat ETIMEDOUT like the other connection failures that already fall
back to a direct app-server.
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