From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 01C6F384B061; Thu, 13 Aug 2020 21:37:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01C6F384B061 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597354637; bh=LbtB6dIgztbLQ9iHiGNfug5lWPk6GaZZu2WWDXdWSNI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=U+nn6cYlJ/nLP1cS4NFX2AbFBkXjFXraOY6R0RT8Mr4lj2tkLRz+EALiW23eglIHT wMoc0PYairMzUCr4kx2f3IPHUYdwnueis2hBPIv4g5EIWkpRQbI2rzWyuxM0COH/cY dML2k/bt89/6RJ9lRFrkCZUTjak3mtzJ17m7Wbbs= From: "lhyatt at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/54185] [4.7/4.8 Regression] condition_variable not properly destructed Date: Thu, 13 Aug 2020 21:37:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.7.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lhyatt at gmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.7.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2020 21:37:17 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D54185 Lewis Hyatt changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lhyatt at gmail dot com --- Comment #14 from Lewis Hyatt --- Created attachment 49061 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D49061&action=3Dedit Fix for random pthread_create() failures Hello- I have problems with the test case for this bug (libstdc++-v3/testsuite/30_threads/condition_variable/54185.cc) failing randomly. It happens more often with parallel make, and especially if runni= ng the testsuite as a whole more than once in parallel. On my system at least (x86-64, Ubuntu 18), it seems that pthread_create() will return EAGAIN sometimes in any loop like the one this testcase uses: for(int i =3D 0; i !=3D 1000; ++i) {pthread_create(...); pthread_join(...);} If such a loop is running in 3 or more processes in parallel it happens more than 50% of the time. I am not sure what global resource gets used up, it happens even if ulimit -a shows nothing being limited like processes or mem= ory. The attached patch fixes the failures for me; if thread creation fails, it = just gives up and moves on to the next iteration instead. I had to convert the cond->wait() to the predicate form since it becomes possible for the notify= to take place prior to all threads calling wait. I can submit this to gcc-patches if it makes sense to you? Thanks... -Lewis=