[v26.1.x] kafka/client: authenticate under the reconnect mutex - #31192
Merged
nvartolomei merged 1 commit intoAug 12, 2026
Merged
Conversation
remote_broker released the reconnect mutex before authenticating, so two concurrent dispatches on a fresh SASL connection could race: the second caller saw the half-set-up connection, skipped auth, and sent its request mid-handshake, which the broker rejects by dropping the connection. Hold the mutex across both reconnect and authentication so a concurrent caller waits until the connection is fully established. On auth failure discard the transport, since SASL authenticates a connection once and recovery must reconnect. Note: the SASL round-trips are bounded by the transport's default request timeout rather than the caller's abort source, which now also caps how long the reconnect mutex is held during auth. This is deliberate: the connect/auth attempt is shared by every caller queued on the mutex, so one caller's abort must not cut short work the others are waiting on -- an aborting caller simply stops waiting on the mutex. Tests cover the race and post-failure connection reuse. (cherry picked from commit b08c929) [v26.1.x: the test used ss::this_smp_shard_count(), which this branch's seastar predates; replaced with ss::smp::count]
nvartolomei
force-pushed
the
ai-backport-pr-31152-v26.1.x-1784570815
branch
from
August 12, 2026 11:27
8bbd832 to
f60a499
Compare
Contributor
|
The build failed because the backported test helper called Verified locally: |
nvartolomei
approved these changes
Aug 12, 2026
nvartolomei
enabled auto-merge
August 12, 2026 11:56
Collaborator
Author
CI test resultstest results on build#88621
|
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.
Backport of PR #31152
Conflict details
//src/v/cluster:*sub-targets (client_quota_backend,cluster_utils,controller_log_limiter,data_migration_table,feature_backend,leader_balancer_strategy,node_status_backend,self_test,topic_metrics_watcher) plus//src/v/configand//src/v/kafka/client:api_typesto thecluster_testdeps. On v26.1.x//src/v/clusteris still a single monolithic target and those fine-grainedsub-targets do not exist, so the granular deps were collapsed to the single
//src/v/clustertarget (the pattern already used by the other test targetsin this file), keeping
//src/v/configand//src/v/kafka/client:api_types.This satisfies every include added to cluster_test.cc
(
cluster/security_frontend.his provided by//src/v/cluster).