X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Mon, 8 Oct 2007 14:36:55 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: 1.5.24-2: pthreads rwlock recursive acquisition failing Message-ID: <20071008123655.GC19254@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <47013115 DOT 1050609 AT securityevaluators DOT com> <470131F4 DOT 5030708 AT securityevaluators DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <470131F4.5030708@securityevaluators.com> User-Agent: Mutt/1.5.16 (2007-06-09) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Oct 1 13:44, Gabriel Landau wrote: > Forgot attachments. Here they are, sorry. > > - Gabriel Landau > > Gabriel Landau wrote: >> Hello, >> I'm trying to develop a program that uses pthreads and needs to >> recursively acquire RO rwlocks and RW rwlocks. I'm not upgrading or >> trying to acquire an RO lock after an RW lock has been acquired, yet >> pthread_rwlock_rdlock() keeps returning EDEADLK. I have tested the >> attached test program (includes at top modified slightly) on Ubuntu Linux >> and it has no recursion problem. >> I'm using Windows Vista (copied cygwin dir from a valid XP install), but >> my friend can reproduce the problem on his Windows XP machine just as >> reliably. >> I've attached an application that demonstrates this bug. You can build it >> with: gcc -o cygwin-pthread-bug.exe cygwin-pthread-bug.c >> Much less importantly, pthread_rwlockattr_setpshared(&lkattr, >> PTHREAD_PROCESS_SHARED) is failing as well. See the attached Shared rwlock vars are currently not supported. The reason is: Nobody implemented them so far. http://cygwin.com/contrib.html >> cygwin-pthread-bug.c for details. >> Please help! Thanks for your time. >> - Gabriel Landau > #include > #include > [...] I have a problem with this testcase. Cygwin is not working the same here as Linux, but your testcase doesn't seem to work as expected on Linux either. I tested your testcase on three different Linux versions and the output is always the same: $ ./cygwin-pthread-bug Lock attribute property set successfully! Unlocking of an unlocked lock succeeded when it should not have. Trying 10 recursive RO locks with NULL (default) attributes ... Lock recursion iteration 0 failed! Lock recursion iteration 1 failed! Lock recursion iteration 2 failed! Lock recursion iteration 3 failed! Lock recursion iteration 4 failed! Lock recursion iteration 5 failed! Lock recursion iteration 6 failed! Lock recursion iteration 7 failed! Lock recursion iteration 8 failed! Lock recursion iteration 9 failed! Unlock recursion iteration 0 succeeded! Unlock recursion iteration 1 succeeded! Unlock recursion iteration 2 succeeded! Unlock recursion iteration 3 succeeded! Unlock recursion iteration 4 succeeded! Unlock recursion iteration 5 succeeded! Unlock recursion iteration 6 succeeded! Unlock recursion iteration 7 succeeded! Unlock recursion iteration 8 succeeded! Unlock recursion iteration 9 succeeded! Unlocking of an unlocked lock succeeded when it should not have. Unlocking of an unlocked lock succeeded when it should not have. Trying 10 recursive RO locks with permissive custom attributes ... Lock recursion iteration 0 failed! Lock recursion iteration 1 failed! Lock recursion iteration 2 failed! Lock recursion iteration 3 failed! Lock recursion iteration 4 failed! Lock recursion iteration 5 failed! Lock recursion iteration 6 failed! Lock recursion iteration 7 failed! Lock recursion iteration 8 failed! Lock recursion iteration 9 failed! Unlock recursion iteration 0 succeeded! Unlock recursion iteration 1 succeeded! Unlock recursion iteration 2 succeeded! Unlock recursion iteration 3 succeeded! Unlock recursion iteration 4 succeeded! Unlock recursion iteration 5 succeeded! Unlock recursion iteration 6 succeeded! Unlock recursion iteration 7 succeeded! Unlock recursion iteration 8 succeeded! Unlock recursion iteration 9 succeeded! Unlocking of an unlocked lock succeeded when it should not have. This output doesn't look very reliable. On Cygwin, at least recursion 0 works fine ;} I'm not overly fluent with pthread usage, but if you can provide a testcase which actually works OOTB on Linux and only shows a problem on Cygwin, I'll have another look. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/