]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix boost::asio::async_write() does not return error... 37157/head
authorMark Kogan <mkogan@redhat.com>
Thu, 2 Jul 2020 16:37:43 +0000 (19:37 +0300)
committerNathan Cutler <ncutler@suse.com>
Tue, 15 Sep 2020 11:48:19 +0000 (13:48 +0200)
although remote has closed the connection

Fixes: https://tracker.ceph.com/issues/46332
Signed-off-by: Mark Kogan <mkogan@redhat.com>
(cherry picked from commit c997eb6ad77deebd8e903fe84da7af6fcf50d528)

src/rgw/rgw_asio_frontend.cc

index dc24ce66e7628bb3d9c5cbd28273b221da9a5eaf..10e8d35a555962e2e6b93f84edb595a8d7a21c57 100644 (file)
@@ -56,6 +56,10 @@ class StreamIO : public rgw::asio::ClientIO {
     auto bytes = boost::asio::write(stream, boost::asio::buffer(buf, len), 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;