From 2ae0df347306071764f1d4cc84a66a7db01cc76d Mon Sep 17 00:00:00 2001 From: Nicolae Vartolomei Date: Sat, 4 May 2024 22:48:46 +0100 Subject: [PATCH] reactor: print scheduling group along with backtrace Backtraces are printed in at least 2 cases: 1) during segfaults, 2) during reactor stalls. Extra context is always helpful in identifying the exact circumstances during which the above happen. E.g. in a server application where user requests are processed in one (or more) scheduling group(s), background processes are split between different scheduling groups as well, knowing the scheduling group narrows the search space. Prior to this commit: ``` Segmentation fault on shard 0. Backtrace: ... ``` With this commit: ``` Segmentation fault on shard 0, in scheduling group main. Backtrace: ... ``` Ref https://github.com/scylladb/seastar/issues/2216 --- src/core/reactor.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/reactor.cc b/src/core/reactor.cc index e1250cc119f..f057efa82d8 100644 --- a/src/core/reactor.cc +++ b/src/core/reactor.cc @@ -143,6 +143,7 @@ module seastar; #include #include #include +#include #include #include #include @@ -848,6 +849,9 @@ static void print_with_backtrace(backtrace_buffer& buf, bool oneline) noexcept { if (local_engine) { buf.append(" on shard "); buf.append_decimal(this_shard_id()); + + buf.append(", in scheduling group "); + buf.append(current_scheduling_group().name().c_str()); } if (!oneline) {