Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v24.1.x] http: Fix double call to stop() in http::client #18428

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/v/http/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,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/include/http/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ class client : protected net::base_transport {
/// Throw exception if _as is aborted
void check() const;

bool _stopped{false};
std::string _host_with_port;
ss::gate _connect_gate;
const ss::abort_source* _as;
Expand Down
Loading