fix(topology): prevent source pump deadlock during sink config reload#6
Open
joshcoughlan wants to merge 3 commits intomasterfrom
Open
fix(topology): prevent source pump deadlock during sink config reload#6joshcoughlan wants to merge 3 commits intomasterfrom
joshcoughlan wants to merge 3 commits intomasterfrom
Conversation
During config reload, when a sink in wait_for_sinks is being changed, remove_inputs previously sent Pause to the upstream fanout. This caused the source pump to block in wait_for_replacements (waiting for a Replace message that only arrives after connect_diff, which runs after shutdown_diff completes). Since shutdown_diff waits for the old sink to finish, this created a circular dependency that stalled all sources. The fix uses Remove instead of Pause for sinks in wait_for_sinks during reload, and correspondingly uses Add instead of Replace when reconnecting them in connect_diff. This allows the source pump to continue sending events to other sinks while the old sink drains, breaking the circular dependency. This is buffer-type agnostic — it fixes the deadlock for memory and disk buffered sinks alike, and only affects the reload path. Refs: vectordotdev#24125 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
During config reload, when a sink in
wait_for_sinksis being changed,remove_inputspreviously sentPauseto the upstream fanout. This caused the source pump to block inwait_for_replacements— waiting for aReplacemessage that only arrives afterconnect_diff, which runs aftershutdown_diffcompletes. Sinceshutdown_diffwaits for the old sink to finish, this created a circular dependency that stalled all sources.The fix uses
Removeinstead ofPausefor sinks inwait_for_sinksduring reload, and correspondingly usesAddinstead ofReplacewhen reconnecting them inconnect_diff. This allows the source pump to continue sending events to other sinks while the old sink drains, breaking the circular dependency.This is buffer-type agnostic — it fixes the deadlock for memory and disk buffered sinks alike, and only affects the reload path.
Vector configuration
How did you test this PR?
topology_reload_conflicting_sink_does_not_stall— verifies reload completes when a sink has conflicting resourcestopology_reload_reuse_buffer_does_not_stall— verifies reload completes when buffer is reused (SIGHUP-style)make check-clippypasses with all features (Docker x86_64 environment)make testpasses (Docker x86_64 environment)make check-fmtpassesChange Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References