Skip to content

Commit

Permalink
http: Close output stream in exceptional cases
Browse files Browse the repository at this point in the history
- Ensure that in the case of an exception when streaming http requests,
the output stream is closed in both the success or failure cases.

- Failure to do so will result in an assertion thrown by seastar when
the output_stream goes out of scope and is deallocated.
  • Loading branch information
graphcareful committed Apr 6, 2023
1 parent 60bd6df commit 7b0389d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/v/http/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ ss::future<client::response_stream_ref> client::request(
fsend = ss::do_with(
request->as_output_stream(),
[&input](ss::output_stream<char>& output) {
return ss::copy(input, output).then([&output] {
return ss::copy(input, output).finally([&output] {
return output.close();
});
});
Expand Down

0 comments on commit 7b0389d

Please sign in to comment.