From: Ilya Dryomov Date: Tue, 4 May 2021 13:50:05 +0000 (+0200) Subject: msg/async/ProtocolV2: catch correct bad_alloc exception X-Git-Tag: v16.2.5~39^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=61b17af8179f902a1ca798ab5b0e8923e1e01a3c;p=ceph.git msg/async/ProtocolV2: catch correct bad_alloc exception We want buffer::bad_alloc, not std::bad_alloc. Otheriwise, we end up with a confusing error failed decoding of frame header: Bad allocation from ProtocolV2::run_continuation(), printed after frame header is successfully decoded. Signed-off-by: Ilya Dryomov (cherry picked from commit 67bb6cf524975ea54d539c5b10ba83fa496a1ced) --- diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc index 855006447f7..c9b2d55e1d8 100644 --- a/src/msg/async/ProtocolV2.cc +++ b/src/msg/async/ProtocolV2.cc @@ -1164,7 +1164,7 @@ CtPtr ProtocolV2::read_frame_segment() { try { rx_buffer = ceph::buffer::ptr_node::create(ceph::buffer::create_aligned( onwire_len, align)); - } catch (std::bad_alloc&) { + } catch (const ceph::buffer::bad_alloc&) { // Catching because of potential issues with satisfying alignment. ldout(cct, 1) << __func__ << " can't allocate aligned rx_buffer" << " len=" << onwire_len