This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cygwin instabilities


On 13/09/2010 17:35, Christopher Faylor wrote:

> You seem to be approaching this problem as if people will say "Ah!
> Stability issues! Right.  Well, ok, here's what you need to know."
> 
> If we knew of stability issues they would be fixed.

  Well, I know of one, but haven't had time to fix it yet, so I keep this hack
in my local builds.  Can't run "make check -jN" without it, but even then it
sometimes locks up.

  The problem I've run into is that on a heavily loaded system, a pinfo struct
can get truncated into a redirector in between the time a syscall checks the
process_state (using ISSTATE or NOTSTATE) and the time it subsequently
attempts to access a pinfo member which it hoped to guard by that check.

  I have a bad feeling that the only way to totally resolve this is going to
be adding lots of locking or mutexing around pinfo calls, which is almost
bound to have performance implications :-(

    cheers,
      DaveK

--- src.clean/winsup/cygwin/pinfo.h	2010-09-01 22:06:36.000000000 +0100
+++ src/winsup/cygwin/pinfo.h	2010-09-06 20:36:17.062500000 +0100
@@ -51,8 +51,6 @@ public:
 
   DWORD exitcode;	/* set when process exits */
 
-#define PINFO_REDIR_SIZE ((char *) &myself.procinfo->exitcode - (char *) myself.procinfo)
-
   /* > 0 if started by a cygwin process */
   DWORD cygstarted;
 
@@ -64,9 +62,6 @@ public:
     signals.  */
   DWORD dwProcessId;
 
-  /* Used to spawn a child for fork(), among other things. */
-  WCHAR progname[NT_MAX_PATH];
-
   /* User information.
      The information is derived from the GetUserName system call,
      with the name looked up in /etc/passwd and assigned a default value
@@ -121,6 +116,12 @@ public:
   HANDLE wr_proc_pipe;
   DWORD wr_proc_pipe_owner;
   friend class pinfo;
+
+  /* Used to spawn a child for fork(), among other things. */
+  WCHAR progname[NT_MAX_PATH];
+  /* Truncate it after execed process exits. */
+#define PINFO_REDIR_SIZE ((char *) &myself.procinfo->progname[0] - (char *) myself.procinfo)
+
 };
 
 DWORD WINAPI commune_process (void *);

--
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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]