From b9dbb83fb9443d6f677262ae37ec40ac186dc271 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Tue, 4 May 2021 15:50:05 +0200 Subject: [PATCH] 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) --- src/msg/async/ProtocolV2.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc index 381d42c3d0aff..b8a805e91c7f1 100644 --- a/src/msg/async/ProtocolV2.cc +++ b/src/msg/async/ProtocolV2.cc @@ -1152,7 +1152,7 @@ CtPtr ProtocolV2::read_frame_segment() { try { rx_buffer = buffer::ptr_node::create(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 -- 2.39.5