public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gatroubo at squizzy dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/100806] New: deadlock in std::counting_semaphore
Date: Thu, 27 May 2021 21:21:25 +0000	[thread overview]
Message-ID: <bug-100806-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 100806
           Summary: deadlock in std::counting_semaphore
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gatroubo at squizzy dot net
  Target Milestone: ---

Hi,

there seems to be some sort of deadlock in std::counting_semaphore. In the
following test program, I create 10 threads, each thread tries to acquire a
semaphore (initial value 4), waits 100ms, and then releases the semaphore:

https://wandbox.org/permlink/Zt3d4EC5vNOXtr9W

Most of the time, the program seems to be in a deadlock after 5 threads
acquired/released the semaphore. When I compile and run the same code with
clang 11.1 I get the expected behavoir (all 10 threads aquire/release the
semaphore and the program exits successfully):

https://wandbox.org/permlink/XjQaoyy9C6uiDYlo

Thanks for your effort to create such a great tool!
-Tobias

             reply	other threads:[~2021-05-27 21:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 21:21 gatroubo at squizzy dot net [this message]
2021-05-28 18:08 ` [Bug libstdc++/100806] " rodgertq at gcc dot gnu.org
2021-06-16 18:45 ` rodgertq at gcc dot gnu.org
2021-06-22 18:07 ` cvs-commit at gcc dot gnu.org
2021-06-22 18:08 ` cvs-commit at gcc dot gnu.org
2022-02-14 17:03 ` rodgertq at gcc dot gnu.org
2022-12-24 21:14 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100806-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).