Skip to content

Commit

Permalink
Merge pull request #18697 from graphcareful/backport-18304-2
Browse files Browse the repository at this point in the history
[v23.2.x] http: Fix double call to stop() in http::client
  • Loading branch information
Rob Blafford authored May 29, 2024
2 parents 9e4bddc + 5baee47 commit 43f2899
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/v/http/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ ss::future<reconnect_result_t> client::get_connected(
}

ss::future<> client::stop() {
if (_stopped) {
// Prevent double call to stop() as constructs such as with_client()
// will unconditionally call stop(), while exception handlers in this
// file may also call stop()
co_return;
}
_stopped = true;
co_await _connect_gate.close();
// Can safely stop base_transport
co_return co_await base_transport::stop();
Expand Down
1 change: 1 addition & 0 deletions src/v/http/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ class client : protected net::base_transport {
/// Throw exception if _as is aborted
void check() const;

bool _stopped{false};
ss::gate _connect_gate;
const ss::abort_source* _as;
ss::shared_ptr<http::client_probe> _probe;
Expand Down

0 comments on commit 43f2899

Please sign in to comment.