Fix resilience relay bind: drain relay poll-waiters on stop/kill#470
Merged
Merged
Conversation
…lake Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
And trim claude code fluff comments.
Member
|
Green on https://github.com/mvdbeek/pulsar/actions/runs/28662443620/job/85006053383, CI is severly hammered so I'll merge. |
mvdbeek
approved these changes
Jul 3, 2026
Contributor
Author
That would be me opening a flurry of pull requests all at the same time 😁. I am done now though and I'll stage bulk changes more slowly in the future. |
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.
Refs #469.
The
Resilience Suiteintermittently fails at fixture setup withTimeoutError: Pulsar did not bind relay consumers within 60.0s(
test/resilience/harness/pulsar_control.py).Cause
For AMQP modes,
PulsarControl.kill()force-drops the stale broker consumer via_force_drop_setup_consumer_connections()so the next setup can't race a lingeringregistration. Relay mode had no equivalent. Pulsar's relay control consumer holds a
30 s
long_pollwaiter on the relay (pulsar/messaging/bind_relay.py); after astop/kill that waiter lingers on the relay until it notices the dropped connection.
Because the readiness check
_relay_has_pulsar_setup_waiter()returnsTrueon anynonzero
*/job_setupwaiter, a following test's setup can pass/race against the deadpulsar's registration.
Fix
Deterministic relay teardown that mirrors the AMQP force-drop:
_relay_setup_waiter_count()(returnsNonewhen the relay is unreachable, so"unknown" is distinguishable from a confirmed zero) and refactor
_relay_has_pulsar_setup_waiter()to build on it._wait_relay_setup_waiters_drained()— polls/messages/poll/statsuntil zero*/job_setupwaiters; best-effort and bounded so it can never hang the suite.stop()andkill()await this drain in relay mode, so the followingwait_until_consuming()only ever sees the freshly-started pulsar.Harness-only change; no production code touched.
Testing
py_compileandflake8(max-line 150, complexity 14) pass.single green run wouldn't prove the fix.
An independent interim mitigation (bind-timeout bump + fixture-setup retry) is proposed
separately in the
469-resilience-timeoutPR; the two are non-overlapping and can landin either order.
🤖 Generated with Claude Code