Mail Archives: cygwin/2000/06/26/18:58:44
On Tue, Jun 27, 2000 at 08:39:56AM +1000, Robert Collins wrote:
> 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().
You'll notice that this is very different from the original problem.
I was able to debug the original problem because the user provided a
code snippet that demonstrated the problem. Providing code that shows a
fork() call does not really demonstrate anything.
You don't seem to have tried to figure out where, specifically, the
code is dying. It seems to be in the cygwin DLL (which doesn't mean
that it is cygwin) but I don't know where.
If you have a cygwin1.dll with debugging symbols, you can get the symbolic
addresses by using the "list" command, i.e.
list *6101EC4E
I'm not sure what thread you are referring to. If it is the other process
then gdb has no way to debug another process currently, unfortunately.
One technique that I use to work around this is to build a cygwin1.dll
and put something like a:
small_printf ("my pid %d\n", GetCurrentProcessId ());
Sleep(15000);
somewhere in the dll_crt0_1 startup code. When the pid is printed, I then
attach to that pid using gdb:
gdb theprogram.exe nnnn
Where nnnn is the reported pid.
cgf
>
>
>================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)
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -