bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TEST AAA


From: Paul Edwards
Subject: Re: TEST AAA
Date: Mon, 22 Sep 2003 10:01:09 GMT

"Pierre" <pceteaudatmacif.fr@netcourrier.com> wrote in message 
b86193eb.0309212318.2d4d44f8@posting.google.com">news:b86193eb.0309212318.2d4d44f8@posting.google.com...
> before close (1) of f0004c00, inspect f0004c20
> fstat of 4 is -1
> after close, fstat of 4 is -1
> Le sous-programme assert a ÚchouÚ : fstat ( fileno (bc->fp), &s ) != -1, 
> fichier
>  buffer.c, ligne 1385
> cvs [login aborted]: received abort signal

Ok, that result surprised me!  Not sure what went wrong there.
Try the latest patch.

By the way, I think the bug is most likely to be the AIX I/O
libraries.  If you edit client.c and search for "AIX" you can
see where they are mentioned.

I think that the workaround they put into client.c is not good
enough to get around the problem.

If you still have the problem raised at IBM, you can ask them
"Is it possible to do two fdopens of the same file descriptor -
note that other Unix systems allow this".


Index: buffer.c
===================================================================
RCS file: /cvs/ccvs/src/buffer.c,v
retrieving revision 1.21.4.1
diff -c -r1.21.4.1 buffer.c
*** buffer.c 17 Feb 2003 21:19:12 -0000 1.21.4.1
--- buffer.c 22 Sep 2003 09:56:54 -0000
***************
*** 1371,1376 ****
--- 1371,1377 ----
  }


+ extern struct stdio_buffer_closure *ugly_hack;

  static int
  stdio_buffer_shutdown (buf)
***************
*** 1388,1397 ****
--- 1389,1421 ----
      {
   buf_flush (buf, 1);
   buf->flush = NULL;
+         if (ugly_hack != NULL)
+         {
+             struct stat s;
+
+             sleep(5);
+             printf("stage 1, old fp %p new fp %p\n",
+                    bc->fp, ugly_hack->fp);
+             printf("fstat of %d is %d\n",
+                    fileno(ugly_hack->fp),
+                    fstat(fileno(ugly_hack->fp), &s));
+         }
      }

      if (buf->input)
      {
+         if (ugly_hack != NULL)
+         {
+             struct stat s;
+
+             sleep(5);
+             printf("stage 2, old fp %p new fp %p\n",
+                    bc->fp, ugly_hack->fp);
+             printf("fstat of %d is %d\n",
+                    fileno(ugly_hack->fp),
+                    fstat(fileno(ugly_hack->fp), &s));
+         }
+
   if ( !buf_empty_p (buf) )
   {
  # ifdef SERVER_SUPPORT
***************
*** 1415,1420 ****
--- 1439,1455 ----
       else
  #endif
    error (0, errno, "reading from %s", current_parsed_root->hostname);
+             if (ugly_hack != NULL)
+             {
+                 struct stat s;
+
+                 sleep(5);
+                 printf("stage 3, old fp %p new fp %p\n",
+                        bc->fp, ugly_hack->fp);
+                 printf("fstat of %d is %d\n",
+                        fileno(ugly_hack->fp),
+                        fstat(fileno(ugly_hack->fp), &s));
+             }
   }

  # ifdef SHUTDOWN_SERVER
***************
*** 1422,1436 ****
--- 1457,1504 ----
  # endif
  # ifndef NO_SOCKET_TO_FD
   {
+             if (ugly_hack != NULL)
+             {
+                 struct stat s;
+
+                 sleep(5);
+                 printf("stage 4, old fp %p new fp %p\n",
+                        bc->fp, ugly_hack->fp);
+                 printf("fstat of %d is %d\n",
+                        fileno(ugly_hack->fp),
+                        fstat(fileno(ugly_hack->fp), &s));
+             }
       /* shutdown() sockets */
       if (S_ISSOCK(s.st_mode))
    shutdown ( fileno (bc->fp), 0);
+             if (ugly_hack != NULL)
+             {
+                 struct stat s;
+
+                 sleep(5);
+                 printf("stage 5, old fp %p new fp %p\n",
+                        bc->fp, ugly_hack->fp);
+                 printf("fstat of %d is %d\n",
+                        fileno(ugly_hack->fp),
+                        fstat(fileno(ugly_hack->fp), &s));
+             }
   }
  # endif /* NO_SOCKET_TO_FD */
  # ifdef START_RSH_WITH_POPEN_RW
   /* Can't be set with SHUTDOWN_SERVER defined */
   else if (pclose (bc->fp) == EOF)
   {
+             if (ugly_hack != NULL)
+             {
+                 struct stat s;
+
+                 sleep(5);
+                 printf("stage 6, old fp %p new fp %p\n",
+                        bc->fp, ugly_hack->fp);
+                 printf("fstat of %d is %d\n",
+                        fileno(ugly_hack->fp),
+                        fstat(fileno(ugly_hack->fp), &s));
+             }
       error (1, errno, "closing connection to %s",
       current_parsed_root->hostname);
       closefp = 0;
***************
*** 1446,1458 ****
--- 1514,1563 ----
    * SHUTDOWN_SERVER_OUTPUT
    */
   if (current_parsed_root->method == server_method)
+         {
       SHUTDOWN_SERVER ( fileno (bc->fp) );
+             if (ugly_hack != NULL)
+             {
+                 struct stat s;
+
+                 sleep(5);
+                 printf("stage 7, old fp %p new fp %p\n",
+                        bc->fp, ugly_hack->fp);
+                 printf("fstat of %d is %d\n",
+                        fileno(ugly_hack->fp),
+                        fstat(fileno(ugly_hack->fp), &s));
+             }
+         }
   else
  # endif
  # ifndef NO_SOCKET_TO_FD
   /* shutdown() sockets */
   if (S_ISSOCK(s.st_mode))
+         {
+             if (ugly_hack != NULL)
+             {
+                 struct stat s;
+
+                 sleep(5);
+                 printf("stage 8, old fp %p new fp %p\n",
+                        bc->fp, ugly_hack->fp);
+                 printf("fstat of %d is %d\n",
+                        fileno(ugly_hack->fp),
+                        fstat(fileno(ugly_hack->fp), &s));
+             }
       shutdown ( fileno (bc->fp), 1);
+             if (ugly_hack != NULL)
+             {
+                 struct stat s;
+
+                 sleep(5);
+                 printf("stage 9, old fp %p new fp %p\n",
+                        bc->fp, ugly_hack->fp);
+                 printf("fstat of %d is %d\n",
+                        fileno(ugly_hack->fp),
+                        fstat(fileno(ugly_hack->fp), &s));
+             }
+         }
  # else
   {
   /* I'm not sure I like this empty block, but the alternative
***************
*** 1464,1473 ****
--- 1569,1610 ----
   buf->output = NULL;
      }

+     if (ugly_hack != NULL)
+     {
+         struct stat s;
+
+         sleep(5);
+         printf("stage 10, old fp %p new fp %p\n",
+                bc->fp, ugly_hack->fp);
+         printf("fstat of %d is %d\n",
+                fileno(ugly_hack->fp),
+                fstat(fileno(ugly_hack->fp), &s));
+     }
+
      if (closefp && fclose (bc->fp) == EOF)
   error (1, errno,
          "closing down connection to %s",
          current_parsed_root->hostname);
+
+     /* FIXME: There appears to be a race condition
+        here.  After the above fclose is executed, it
+        would appear that the other side is able to
+        close their side down, so that when this function
+        is called for a second time, the previously
+        open file is no longer available, and the fstat
+        fails, and the assertion error fails.  You can
+        see this by uncommenting the following sleep.
+        At least this is the behaviour on one AIX
+        system where client and server are on same
+        machine and "cvs login" is executed. */
+     if (ugly_hack != NULL) sleep(5);
+
+     if (ugly_hack != NULL)
+     {
+         printf("after close, fstat of %d is %d\n",
+                fileno(ugly_hack->fp),
+                fstat(fileno(ugly_hack->fp), &s));
+     }

      /* If we were talking to a process, make sure it exited */
      if (bc->child_pid)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]