]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/crimson: fix a race condition in SeastarRunner
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 11 Jan 2022 12:09:28 +0000 (12:09 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 11 Jan 2022 13:04:02 +0000 (13:04 +0000)
This patch is supposed to fix the following problem:

```
        Start 234: unittest-seastar-errorator
216/258 Test #234: unittest-seastar-errorator ................Child aborted***Exception:   0.95 sec
WARNING: debug mode. Not for benchmarking or production
WARN  2022-01-11 10:01:32,973 [shard 0] seastar - Creation of perf_event based stall detector failed, falling back to posix timer: std::system_error (error system:13, perf_event_open() failed: Permission denied)
unittest-seastar-errorator: ../src/test/crimson/seastar_runner.h:45: int SeastarRunner::init(int, char **): Assertion `begin_signaled == true' failed.
Aborting.
Backtrace:
  0xb3397a
  0x1d19430
  0x1d1905d
  0x1b72332
  0x1b9dd95
  0x1c75fe9
  0x1c76231
  0x1c7605a
  0x7f20b7aee3bf
  /lib/x86_64-linux-gnu/libc.so.6+0x4618a
  /lib/x86_64-linux-gnu/libc.so.6+0x25858
  /lib/x86_64-linux-gnu/libc.so.6+0x25728
  /lib/x86_64-linux-gnu/libc.so.6+0x36f35
  0xc8bb88
  0xc7ec71
  /lib/x86_64-linux-gnu/libc.so.6+0x270b2
  0xafc95d
```

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/test/crimson/seastar_runner.h

index a6a4f98729192f65bc5f820d9057c3236370fb91..79f1387179067efc50e0e9ea665d1dbfa885d509 100644 (file)
@@ -69,9 +69,9 @@ struct SeastarRunner {
     auto ret = app.run(argc, argv, [this] {
       on_end.reset(new seastar::readable_eventfd);
       return seastar::now().then([this] {
+       begin_signaled = true;
        auto r = ::eventfd_write(begin_fd.get(), APP_RUNNING);
        assert(r == 0);
-       begin_signaled = true;
        return seastar::now();
       }).then([this] {
        return on_end->wait().then([](size_t){});
@@ -85,8 +85,8 @@ struct SeastarRunner {
       std::cerr << "Seastar app returns " << ret << std::endl;
     }
     if (!begin_signaled) {
-      ::eventfd_write(begin_fd.get(), APP_NOT_RUN);
       begin_signaled = true;
+      ::eventfd_write(begin_fd.get(), APP_NOT_RUN);
     }
   }