From 7b0389dcf0e8be66ba452bb3f76780a335948066 Mon Sep 17 00:00:00 2001 From: Rob Blafford Date: Thu, 6 Apr 2023 16:27:28 -0400 Subject: [PATCH] http: Close output stream in exceptional cases - 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. --- src/v/http/client.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v/http/client.cc b/src/v/http/client.cc index d369a3289b57..29c4f61f403c 100644 --- a/src/v/http/client.cc +++ b/src/v/http/client.cc @@ -589,7 +589,7 @@ ss::future client::request( fsend = ss::do_with( request->as_output_stream(), [&input](ss::output_stream& output) { - return ss::copy(input, output).then([&output] { + return ss::copy(input, output).finally([&output] { return output.close(); }); });