Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Issue 252 in memcached: testapp.c sometimes fails due to race condition
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
memcac...@googlecode.com  
View profile  
 More options Feb 11 2012, 3:36 am
From: memcac...@googlecode.com
Date: Sat, 11 Feb 2012 08:36:44 +0000
Local: Sat, Feb 11 2012 3:36 am
Subject: Issue 252 in memcached: testapp.c sometimes fails due to race condition
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 252 by superama...@gmail.com: testapp.c sometimes fails due to  
race condition
http://code.google.com/p/memcached/issues/detail?id=252

What steps will reproduce the problem?
1. build memcached, run 'make check' and then ./testapp
2. Repeat many many times. Seems to fail more often on linux ppc64 and os x

Alternatively apply this patch to create an artificial race:

diff --git a/memcached.c b/memcached.c
index b121e16..678690b 100644
--- a/memcached.c
+++ b/memcached.c
@@ -4604,6 +4604,8 @@ static void save_pid(const char *pid_file) {
          return;
      }

+    usleep(25);
+
      fprintf(fp,"%ld\n", (long)getpid());
      if (fclose(fp) == -1) {
          vperror("Could not close the pid file %s", pid_file);

Error will be something like:

testapp: testapp.c:397: start_server: Assertion `fgets(buffer,  
sizeof(buffer), fp) != ((void *)0)' failed.

What version of the product are you using? On what operating system?

Have seen this on 1.4.13, and trunk, on Ubuntu.

Note that there is even a comment in this test that acknowledges the  
problem:

         /* loop and wait for the pid file.. There is a potential race
          * condition that the server just created the file but isn't
          * finished writing the content, but I'll take the chance....
          */

The attached patch solves the issue by retrying 5 times with 10us sleeps in  
between.

Attachments:
        fix-racey-test.patch  1.2 KB


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
memcac...@googlecode.com  
View profile  
 More options Apr 4 2012, 12:44 pm
From: memcac...@googlecode.com
Date: Wed, 04 Apr 2012 16:44:36 +0000
Local: Wed, Apr 4 2012 12:44 pm
Subject: Re: Issue 252 in memcached: testapp.c sometimes fails due to race condition

Comment #1 on issue 252 by ringo.p...@gmail.com: testapp.c sometimes fails  
due to race condition
http://code.google.com/p/memcached/issues/detail?id=252

Discussed with Clint on irc - this is the patch we are using for the  
official Ubuntu 12.04 memcached package.

Attachments:
        60_fix_racey_test.patch  1.2 KB


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
memcac...@googlecode.com  
View profile  
 More options Jul 27 2012, 5:29 am
From: memcac...@googlecode.com
Date: Fri, 27 Jul 2012 09:29:13 +0000
Local: Fri, Jul 27 2012 5:29 am
Subject: Re: Issue 252 in memcached: testapp.c sometimes fails due to race condition
Updates:
        Status: Fixed

Comment #2 on issue 252 by dorma...@rydia.net: testapp.c sometimes fails  
due to race condition
http://code.google.com/p/memcached/issues/detail?id=252

Should've had a failsafe at the end to still assert on NULL but that's  
pedantic.

should hopefully have the daemonization process made more robust in the  
next few cuts and it won't matter. thanks!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »