From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1341 invoked by alias); 14 Feb 2012 21:43:56 -0000 Received: (qmail 1327 invoked by uid 22791); 14 Feb 2012 21:43:54 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,TW_FC X-Spam-Check-By: sourceware.org Received: from qmta04.westchester.pa.mail.comcast.net (HELO qmta04.westchester.pa.mail.comcast.net) (76.96.62.40) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Feb 2012 21:43:41 +0000 Received: from omta03.westchester.pa.mail.comcast.net ([76.96.62.27]) by qmta04.westchester.pa.mail.comcast.net with comcast id Zw231i0040bG4ec54xjhmd; Tue, 14 Feb 2012 21:43:41 +0000 Received: from mail.daveroth.dyndns.org ([24.22.184.108]) by omta03.westchester.pa.mail.comcast.net with comcast id Zxjg1i00W2LkTg83PxjhVx; Tue, 14 Feb 2012 21:43:41 +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 q1ELhb9L031600 for ; Tue, 14 Feb 2012 13:43:37 -0800 Message-ID: <4F3AD58A.9040106@acm.org> Date: Tue, 14 Feb 2012 21:43:00 -0000 From: David Rothenberger User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.1) Gecko/20120208 Thunderbird/10.0.1 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: STC for libapr1 failure References: <4F3A14A8.4090506@acm.org> <20120214140240.GB25918@calimero.vinschen.de> <20120214144551.GC25918@calimero.vinschen.de> <4F3AA0BB.7000806@acm.org> <20120214182452.GK25918@calimero.vinschen.de> In-Reply-To: <20120214182452.GK25918@calimero.vinschen.de> Content-Type: multipart/mixed; boundary="------------000707000305030706040608" 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: 2012-02/txt/msg00430.txt.bz2 --------------000707000305030706040608 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 1593 On 2/14/2012 10:24 AM, Corinna Vinschen wrote: > On Feb 14 09:58, David Rothenberger wrote: >> On 2/14/2012 6:45 AM, Corinna Vinschen wrote: >>> On Feb 14 15:02, Corinna Vinschen wrote: >>>> On Feb 14 00:00, David Rothenberger wrote: >>>>> The libapr1 test cases are failing again for flock locks. This same >>>>> test case failed with 1.7.9 with a fatal error[1], but that was >>>>> corrected. The test is no longer encountering the fatal error, but >>>>> it is producing the wrong result. >>>> >>>> Thanks for the testcase. I think I found the issue. An event handle >>>> was closed in the wrong place, outside of the important mutex lock for >>>> the lock object. I applied the patch to CVS. Your testcase now appears >>>> to run fine for me. Can you try your entire testsuite again and see >>>> if there's another failure lurking? >>> >>> I uploaded a snapshot for testing. >> >> Thanks. The snapshot fixes the flock test case, but now the fcntl test >> case is failing. > > *Sob*. How so? Does it hang or does it allow multiple concurrent > exclusive locks as the flock case? Sorry, I should have said. It hangs. >> I'll try to send an STC for that case, but I suspect the one from last >> year will have the problem. > > Please send it anyway. It's attached. If you run it with an argument (any argument), each child will print its loop count and you can see what happens. If it doesn't hang for you, try increasing MAX_ITER or CHILDREN at the top. -- David Rothenberger ---- daveroth@acm.org QOTD: "Oh, no, no... I'm not beautiful. Just very, very pretty." --------------000707000305030706040608 Content-Type: text/plain; name="stc-fcntl-fork.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="stc-fcntl-fork.c" Content-length: 4653 /*********************************************************************** * This is a STC to show that fcntl hangs. * * 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 flock to lock and unlock it. * * While each child has the lock, it increments a counter stored in * shared memory in a racy way, passing the current value to a function * which sleeps briefly, then returns the incremented counter. * * If all works correctly, the counter should end up be incremented * by each child iteration. * * However, this test currently just hangs. * * Compile: gcc -Wall -o stc-flock-fork stc-flock-fork.c ***********************************************************************/ #include #include #include #include #include #include #include #define NUM_TEST_ITERS 1 #define MAX_ITER 10 #define CHILDREN 3 #define MAX_COUNT (MAX_ITER * CHILDREN) /* Counter stored in shared memory. */ static volatile int *x; /* A temporary file used for fcntl. */ char tmpfilename[] = "/tmp/fcntlXXXXXX"; struct flock mutex_lock_it; struct flock mutex_unlock_it; /* a slower more racy way to implement (*x)++ */ static int increment(int n) { usleep(1); return n+1; } /* Fork and use fcntl to lock and unlock the file repeatedly in the child. */ void make_child(int childnum, int verbose, 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 1) ? 1 : 0; /* Create the temporary file. */ fd = mkstemp(tmpfilename); if (fd < 0) { perror("open failed"); exit(1); } close(fd); /* Initialize shared memory */ init_shm(); /* Setup mutexes */ mutex_lock_it.l_whence = SEEK_SET; /* from current point */ mutex_lock_it.l_start = 0; /* -"- */ mutex_lock_it.l_len = 0; /* until end of file */ mutex_lock_it.l_type = F_WRLCK; /* set exclusive/write lock */ mutex_lock_it.l_pid = 0; /* pid not actually interesting */ mutex_unlock_it.l_whence = SEEK_SET; /* from current point */ mutex_unlock_it.l_start = 0; /* -"- */ mutex_unlock_it.l_len = 0; /* until end of file */ mutex_unlock_it.l_type = F_UNLCK; /* set exclusive/write lock */ mutex_unlock_it.l_pid = 0; /* pid not actually interesting */ /* Perform the test multiple times. */ for (i = 0; i < NUM_TEST_ITERS; ++i) { /* Create the children. */ for (n = 0; n < CHILDREN; n++) make_child(n, verbose, 0, &child[n]); /* Wait for them to finish. */ for (n = 0; n < CHILDREN; n++) await_child(child[n]); /* Check counter */ if (*x != MAX_COUNT) { printf("Iteration %d: FAILED: *x (%d) != MAX_COUNT (%d)\n", i, *x, MAX_COUNT); exit(1); } } /* Clean up. */ unlink(tmpfilename); return 0; } --------------000707000305030706040608 Content-Type: text/plain; charset=us-ascii Content-length: 218 -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple --------------000707000305030706040608--