Skip to content

Commit

Permalink
test/crimson/test_messenger_thrash: fix local variable out of scope i…
Browse files Browse the repository at this point in the history
…n async task

test_messenger_thrash UT shows,

```
==461141==ERROR: AddressSanitizer: stack-use-after-return on address 0xffffb0b37c20 at pc 0xaaaad7239508 bp 0xffffeb113c50 sp 0xffffeb113c48
READ of size 4 at 0xffffb0b37c20 thread T0
    #0 0xaaaad7239504 in (anonymous namespace)::SyntheticWorkload::wait_for_done()::'lambda0'()::operator()() const /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/test/crimson/test_messenger_thrash.cc:455:13
    #1 0xaaaad723a1c0 in seastar::internal::do_until_state<(anonymous namespace)::SyntheticWorkload::wait_for_done()::'lambda'(), (anonymous namespace)::SyntheticWorkload::wait_for_done()::'lambda0'()>::run_and_dispose() /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/seastar/include/seastar/core/loop.hh:303:26
    ceph#2 0xaaaadacfb790 in seastar::reactor::run_tasks(seastar::reactor::task_queue&) /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/seastar/src/core/reactor.cc:2653:14
    ceph#3 0xaaaadad04288 in seastar::reactor::run_some_tasks() /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/seastar/src/core/reactor.cc:3123:9
    ceph#4 0xaaaadad07cd0 in seastar::reactor::do_run() /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/seastar/src/core/reactor.cc:3291:9
    ceph#5 0xaaaadad05d60 in seastar::reactor::run() /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/seastar/src/core/reactor.cc:3181:16
    ceph#6 0xaaaadaa860d8 in seastar::app_template::run_deprecated(int, char**, std::function<void ()>&&) /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/seastar/src/core/app-template.cc:276:31
    ceph#7 0xaaaadaa83fb0 in seastar::app_template::run(int, char**, std::function<seastar::future<int> ()>&&) /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/seastar/src/core/app-template.cc:167:12
    ceph#8 0xaaaad7203d88 in main /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/test/crimson/test_messenger_thrash.cc:669:14
    ceph#9 0xffffb32773f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    ceph#10 0xffffb32774c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    ceph#11 0xaaaad712546c in _start (/home/jenkins-build/build/workspace/ceph-pull-requests-arm64/build/bin/unittest-seastar-messenger-thrash+0x3b5546c) (BuildId: b0048d750e057d178816f94b3ce0459971785191)
```

Address 0xffffb0b37c20 is located in stack of thread T0 at offset 32 in frame
    #0 0xaaaad7493ed8 in ceph::buffer::v15_2_0::list::buffers_t::clear_and_dispose() /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/include/buffer.h:596

Signed-off-by: arm7star <[email protected]>
  • Loading branch information
arm7star committed Sep 14, 2024
1 parent e5d6b43 commit e4434fe
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/test/crimson/test_messenger_thrash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -447,15 +447,16 @@ class SyntheticWorkload {
}

seastar::future<> wait_for_done() {
int i = 0;
return seastar::do_until(
[this] { return !dispatcher.get_num_pending_msgs(); },
[this, &i]
{
if (i++ % 50 == 0){
print_internal_state(true);
}
return seastar::sleep(100ms);
return seastar::do_with(0, [this] (int &i) {
return seastar::do_until(
[this] { return !dispatcher.get_num_pending_msgs(); },
[this, &i] {
if (i++ % 50 == 0) {
print_internal_state(true);
}
return seastar::sleep(100ms);
}
);
}).then([this] {
return seastar::do_for_each(available_servers, [] (auto server) {
if (verbose) {
Expand Down

0 comments on commit e4434fe

Please sign in to comment.