From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15030 invoked by alias); 27 Aug 2011 22:27:50 -0000 Received: (qmail 15020 invoked by uid 22791); 27 Aug 2011 22:27:49 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,TW_FC X-Spam-Check-By: sourceware.org Received: from qmta06.westchester.pa.mail.comcast.net (HELO qmta06.westchester.pa.mail.comcast.net) (76.96.62.56) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 27 Aug 2011 22:27:33 +0000 Received: from omta22.westchester.pa.mail.comcast.net ([76.96.62.73]) by qmta06.westchester.pa.mail.comcast.net with comcast id RaGp1h0091ap0As56aTZjo; Sat, 27 Aug 2011 22:27:33 +0000 Received: from mail.daveroth.dyndns.org ([24.16.31.212]) by omta22.westchester.pa.mail.comcast.net with comcast id RaTX1h01U4abx5U3iaTYwa; Sat, 27 Aug 2011 22:27:33 +0000 Received: from [10.249.1.104] (tela64.daveroth.dyndns.org [10.249.1.104]) (authenticated bits=0) by mail.daveroth.dyndns.org (8.14.3/8.14.3/Debian-9.4) with ESMTP id p7RMRQTe009572 for ; Sat, 27 Aug 2011 15:27:27 -0700 Message-ID: <4E596F50.3050205@acm.org> Date: Sat, 27 Aug 2011 22:27:00 -0000 From: David Rothenberger User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: STC for libapr1 failure References: <4E56EB24.5000505@acm.org> <20110826111509.GH10490@calimero.vinschen.de> <20110827203706.GA15411@calimero.vinschen.de> In-Reply-To: <20110827203706.GA15411@calimero.vinschen.de> Content-Type: multipart/mixed; boundary="------------090606020903050607050304" X-IsSubscribed: yes Reply-To: cygwin@cygwin.com Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-08/txt/msg00496.txt.bz2 --------------090606020903050607050304 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 1469 On 8/27/2011 1:37 PM, Corinna Vinschen wrote: > On Aug 26 13:15, Corinna Vinschen wrote: >> On Aug 25 17:39, David Rothenberger wrote: >>> For a while now, the test cases that come with libapr1 have been >>> bombing with this message: >>> >>> *** fatal error - NtCreateEvent(lock): 0xC0000035 >>> >>> I finally took some time to investigate and have extracted a STC >>> that demonstrates the problem. >> >> Thanks a lot for the testcase. In theory, the NtCreateEvent call should >> not have happened at all, since it's called under lock, and the code >> around that should have made sure that the object doesn't exist at the >> time. >> >> After a few hours of extrem puzzlement, I now finally know what happens. >> It's kinda hard to explain. >> [... very good description of flock problem ...] > > Please test the latest snapshot. It should fix this problem, as well as > a starvation problem with signals (and, fwiw, thread cancel events) in > flock, lockf, and POSIX fcntl locks. The new snapshot runs the flock STC. Thanks! I've been building libapr1 without F_SETLK support for a while since it was also triggering the "NtCreateEvent(lock): 0xC0000035" error. Since you mentioned fcntl, I tried re-enabling the fcntl mutexes. They still trigger the error. I've attached a similar STC that uses fcntl instead of flock. -- David Rothenberger ---- daveroth@acm.org "It's what you learn after you know it all that counts." -- John Wooden --------------090606020903050607050304 Content-Type: text/plain; name="stc-fcntl-fork.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="stc-fcntl-fork.c" Content-length: 3254 /*********************************************************************** * This is a STC that causes the following error on my test machine: * NtCreateEvent(lock): 0xC0000035 * * It tries to use fcntl() for file locking. It creates a temporary * file, the uses fork to spawn a number of children. Each child opens * the file, then repeatedly uses fcntl to lock and unlock it. * * This test was extracted from the APR test suite. * * Compile: gcc -Wall -o stc-fcntl-fork stc-fcntl-fork.c ***********************************************************************/ #include #include #include #include #include #include #define MAX_ITER 2000 #define CHILDREN 6 /* A temporary file used for fcntl. */ char tmpfilename[] = "/tmp/fcntlXXXXXX"; struct flock mutex_lock_it; struct flock mutex_unlock_it; /* Fork and use fcntl to lock and unlock the file repeatedly in the child. */ void make_child(int trylock, pid_t *pid) { if ((*pid = fork()) < 0) { perror("fork failed"); exit(1); } else if (*pid == 0) { int fd2 = open(tmpfilename, O_RDWR); if (fd2 < 0) { perror("child open"); exit(1); } int rc; int i; for (i=0; i