public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/114953] New: libstdc++'s 30_threads/semaphore/try_acquire_posix.cc can sometimes fail (while running under qemu)
@ 2024-05-06  0:09 pinskia at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: pinskia at gcc dot gnu.org @ 2024-05-06  0:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114953

            Bug ID: 114953
           Summary: libstdc++'s 30_threads/semaphore/try_acquire_posix.cc
                    can sometimes fail (while running under qemu)
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: testsuite-fail
          Severity: normal
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

The testcase has:
```
  auto const dur = 250ms;
...
    auto const at = std::chrono::system_clock::now() + dur;
    auto const t0 = std::chrono::steady_clock::now();
    VERIFY( !s._M_try_acquire_until(at) );
    auto const diff = std::chrono::steady_clock::now() - t0;
    VERIFY( diff >= dur );
```

So the difference here might be less than 250ms because it might be that t0
might have been a few (one or two?) microseconds after at was set.
This testcase failed for me with -std=c++26 but passed for -std=c++20 while
running in the testsuite but on a semi-loaded system and running under qemu. So
it just happened to hit the failure in that case. I suspect it could fail while
not running under qemu but with a heavy load on the system and it just happens
to be time sliced out between the 2 calls to now().

Maybe there should only 1 call to now before until so you don't run into
spurious failure like this.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-06  0:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-06  0:09 [Bug testsuite/114953] New: libstdc++'s 30_threads/semaphore/try_acquire_posix.cc can sometimes fail (while running under qemu) pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).