From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13513 invoked by alias); 12 Feb 2013 17:04:15 -0000 Received: (qmail 13421 invoked by uid 22791); 12 Feb 2013 17:04:12 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Feb 2013 17:04:03 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1CH43ff021478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 12 Feb 2013 12:04:03 -0500 Received: from host2.jankratochvil.net (ovpn-116-18.ams2.redhat.com [10.36.116.18]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1CH3xh8030280 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Tue, 12 Feb 2013 12:04:01 -0500 Date: Tue, 12 Feb 2013 17:04:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] testsuite: pthread_cond_wait.exp: Avoid a race Message-ID: <20130212170358.GA5633@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-02/txt/msg00278.txt.bz2 Hi, -PASS: gdb.threads/pthread_cond_wait.exp: backtrace in blocked thread +FAIL: gdb.threads/pthread_cond_wait.exp: backtrace in blocked thread -Thread 2 (Thread 0xf7dd6b40 (LWP 4893)):^M +Thread 2 (Thread 0xf7dd6b40 (LWP 4754)):^M #0 0xf7fdc430 in __kernel_vsyscall ()^M -#1 0xf7fc012c in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:172^M -#2 0x08048683 in cond_wait (cond=0xf7dd6308, mut=0xf7dd6338) at gdb/testsuite/gdb.threads/pthread_cond_wait.c:28^M -#3 0x080486ce in noreturn () at gdb/testsuite/gdb.threads/pthread_cond_wait.c:43^M -#4 0x080486db in forever_pthread (unused=0x0) at gdb/testsuite/gdb.threads/pthread_cond_wait.c:49^M -#5 0xf7fbcadf in start_thread (arg=0xf7dd6b40) at pthread_create.c:309^M -#6 0xf7ecd42e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:133^M +#1 0xf7fc2dd2 in __lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S:98^M +#2 0xf7fbd7b2 in _L_lock_3175 () from /lib/libpthread.so.0^M +#3 0xf7fbccc9 in start_thread (arg=0xf7dd6b40) at pthread_create.c:298^M +#4 0xf7ecd42e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:133^M ^M -Thread 1 (Thread 0xf7dd76c0 (LWP 4745)):^M +Thread 1 (Thread 0xf7dd76c0 (LWP 4628)):^M #0 break_me () at gdb/testsuite/gdb.threads/pthread_cond_wait.c:56^M #1 0x08048738 in main () at gdb/testsuite/gdb.threads/pthread_cond_wait.c:68^M -(gdb) PASS: gdb.threads/pthread_cond_wait.exp: backtrace in blocked thread +(gdb) FAIL: gdb.threads/pthread_cond_wait.exp: backtrace in blocked thread It is just too racy. I will check in the easy workaround below, it is sure not a real fix. Thanks, Jan gdb/testsuite/ 2013-02-12 Jan Kratochvil * gdb.threads/pthread_cond_wait.c (main): Remove variable ts. Replace nanosleep by sleep. diff --git a/gdb/testsuite/gdb.threads/pthread_cond_wait.c b/gdb/testsuite/gdb.threads/pthread_cond_wait.c index a639e41..3c28e13 100644 --- a/gdb/testsuite/gdb.threads/pthread_cond_wait.c +++ b/gdb/testsuite/gdb.threads/pthread_cond_wait.c @@ -59,12 +59,11 @@ int main (void) { pthread_t forever; - const struct timespec ts = { 0, 10000000 }; /* 0.01 sec */ pthread_create (&forever, NULL, forever_pthread, NULL); for (;;) { - nanosleep (&ts, NULL); + sleep (2); break_me(); }