From c997eb6ad77deebd8e903fe84da7af6fcf50d528 Mon Sep 17 00:00:00 2001 From: Mark Kogan Date: Thu, 2 Jul 2020 19:37:43 +0300 Subject: [PATCH] rgw: fix boost::asio::async_write() does not return error... although remote has closed the connection Fixes: https://tracker.ceph.com/issues/46332 Signed-off-by: Mark Kogan --- src/rgw/rgw_asio_frontend.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rgw/rgw_asio_frontend.cc b/src/rgw/rgw_asio_frontend.cc index 5d097733624..c8158db9eb3 100644 --- a/src/rgw/rgw_asio_frontend.cc +++ b/src/rgw/rgw_asio_frontend.cc @@ -69,6 +69,10 @@ class StreamIO : public rgw::asio::ClientIO { yield[ec]); if (ec) { ldout(cct, 4) << "write_data failed: " << ec.message() << dendl; + if (ec==boost::asio::error::broken_pipe) { + boost::system::error_code ec_ignored; + stream.lowest_layer().shutdown(tcp::socket::shutdown_both, ec_ignored); + } throw rgw::io::Exception(ec.value(), std::system_category()); } return bytes;