Skip to content

Commit

Permalink
reactor: print scheduling group along with backtrace
Browse files Browse the repository at this point in the history
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 #2216

Closes #2221
  • Loading branch information
nvartolomei authored and xemul committed May 14, 2024
1 parent 9c42116 commit d1ec692
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/reactor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ module seastar;
#include <seastar/core/reactor.hh>
#include <seastar/core/report_exception.hh>
#include <seastar/core/resource.hh>
#include <seastar/core/scheduling.hh>
#include <seastar/core/scheduling_specific.hh>
#include <seastar/core/sleep.hh>
#include <seastar/core/smp_options.hh>
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit d1ec692

Please sign in to comment.