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: v17.1.0~2034^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=67bb6cf524975ea54d539c5b10ba83fa496a1ced;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 --- diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc index 2419aabe2ff9..0f40b32ac46b 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