Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <00ff01bfdfbf$7503e3c0$f7c723cb@lifelesswks> From: "Robert Collins" To: References: <39575D69 DOT A83E2E12 AT kbotd DOT ru> <20000626112801 DOT D1064 AT cygnus DOT com> Subject: Re: cygwin1.dll (v1.1.2): dup2() with invalid newfd lead to exception: STATUS_ACCESS_VIOLATION Date: Tue, 27 Jun 2000 08:39:56 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Chris, any time to look at a bug report on a fork() call? Its the same package (squid 2.3-STABLE3) during startup, it stackdumps. I have been trying to debug this w/gdb (both your updated version, and the text-console version 5 from sourceware). gdb seems to work ok, but I cannot follow the second thread.. I have included a stackdump and the funciton that calls fork(). ================source function static void watch_child(char *argv[]) { char *prog; int failcount = 0; time_t start; time_t stop; #ifdef _SQUID_NEXT_ union wait status; #else int status; #endif pid_t pid; int i; if (*(argv[0]) == '(') return; openlog(appname, LOG_PID | LOG_NDELAY | LOG_CONS, LOG_LOCAL4); if ((pid = fork()) < 0) syslog(LOG_ALERT, "fork failed: %s", xstrerror()); else if (pid > 0) exit(0); if (setsid() < 0) syslog(LOG_ALERT, "setsid failed: %s", xstrerror()); closelog(); #ifdef TIOCNOTTY if ((i = open("/dev/tty", O_RDWR)) >= 0) { ioctl(i, TIOCNOTTY, NULL); close(i); } #endif for (i = 0; i < Squid_MaxFD; i++) close(i); for (;;) { if ((pid = fork()) == 0) { /* child */ openlog(appname, LOG_PID | LOG_NDELAY | LOG_CONS, LOG_LOCAL4); prog = xstrdup(argv[0]); argv[0] = xstrdup("(squid)"); execvp(prog, argv); syslog(LOG_ALERT, "execvp failed: %s", xstrerror()); } /* parent */ openlog(appname, LOG_PID | LOG_NDELAY | LOG_CONS, LOG_LOCAL4); syslog(LOG_NOTICE, "Squid Parent: child process %d started", pid); time(&start); squid_signal(SIGINT, SIG_IGN, SA_RESTART); #ifdef _SQUID_NEXT_ pid = wait3(&status, 0, NULL); #else pid = waitpid(-1, &status, 0); #endif time(&stop); if (WIFEXITED(status)) { syslog(LOG_NOTICE, "Squid Parent: child process %d exited with status %d", pid, WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { syslog(LOG_NOTICE, "Squid Parent: child process %d exited due to signal %d", pid, WTERMSIG(status)); } else { syslog(LOG_NOTICE, "Squid Parent: child process %d exited", pid); } if (stop - start < 10) failcount++; else failcount = 0; if (failcount == 5) { syslog(LOG_ALERT, "Exiting due to repeated, frequent failures"); exit(1); } if (WIFEXITED(status)) if (WEXITSTATUS(status) == 0) exit(0); squid_signal(SIGINT, SIG_DFL, SA_RESTART); sleep(3); } /* NOTREACHED */ } ========================== =====stackdump===== bash-2.04$ cat squid.exe.stackdump Exception: STATUS_ACCESS_VIOLATION at eip=610294FD eax=026AFDFC ebx=00000000 ecx=00000000 edx=61084BE8 esi=00000000 edi=FFFFFFFF ebp=026AFD60 esp=026AFC18 program=E:\cygwin\usr\local\squid\bin\squid.exe cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023 Stack trace: Frame Function Args 026AFD60 6101EC4E (00000000, 026AFDFC, 00000000, 000000E8) 026AFE00 6101EC4E (61084BE8, 00000000, 00000000, 00000000) 026AFE30 6101EF42 (61084BE8, 00000000, 00000000, 00000000) 026AFE80 6101FA61 (61084BE8, 00020938, 026AFEC0, 6102E668) 026AFEC0 6102E685 (00020938, 0000007C, 026AFF00, 610020C6) 026AFF00 61002135 (7FFDF000, 00000000, 00000000, 00000000) 026AFF60 610027D5 (00509950, 00000000, 026AFF90, 0048EA9E) 026AFF90 0048EAAB (0044EBF4, FFFFFFFF, 80430B27, 00000000) 026AFFC0 0040103B (00000000, 00000000, 7FFDF000, 00000000) 026AFFF0 77E87903 (00401000, 00000000, 000000C8, 00000100) ----- Original Message ----- From: "Chris Faylor" To: Sent: Tuesday, June 27, 2000 1:28 AM Subject: Re: cygwin1.dll (v1.1.2): dup2() with invalid newfd lead to exception: STATUS_ACCESS_VIOLATION > On Mon, Jun 26, 2000 at 05:40:58PM +0400, Alexander Trush wrote: <...> > It was a problem with an out of bounds "new fd". I've checked in a patch > to fix this. It will be in the next snapshot and also in the next net release. > > Thanks for the bug report and, most importantly for a relatively simple test > case so that we didn't have to guess about what was wrong. > -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com