From d1ec692b7d562e1a43ac881d39d070373967ae3b 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 Closes scylladb/seastar#2221 --- src/core/reactor.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/reactor.cc b/src/core/reactor.cc index 7c9105b5cff..1fe0f8608f9 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) {