[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Google
  Web www.spinics.net

Re: crash sometimes doesn't terminate, loops forever looking for a process that doesn't exist




----- Original Message -----
>
> > Adrien,
> >
> > How does the attached patch work for you?
> 
> Thanks for the quick response time. I am sorry but I am unlikely to be
> able to test this patch until mid December.
> 

No problem -- by that time crash-6.0.1 will be released.  Plus I also
changed the patch slightly (attached).

Thanks,
  Dave
--- cmdline.c	25 Feb 2011 20:24:45 -0000	1.48
+++ cmdline.c	9 Nov 2011 15:57:08 -0000	1.49
@@ -735,9 +735,10 @@
 	char *arglist[MAXARGS];
 	int argc;
 	FILE *pipe;
-	int retries;
+	int retries, shell_has_exited;
 
 	retries = 0;
+	shell_has_exited = FALSE;
 	pc->pipe_pid = pc->pipe_shell_pid = 0;
         sprintf(lookfor, "(%s)", pc->pipe_command);
 	stall(1000);
@@ -757,8 +758,11 @@
                                         p_pid = strtok(NULL, " ");
                                         pgrp = strtok(NULL, " ");
 				        if (STREQ(name, "(sh)") &&
-					    (atoi(p_pid) == getpid())) 
+					    (atoi(p_pid) == getpid())) { 
 						pc->pipe_shell_pid = atoi(pid);
+						if (STREQ(status, "Z"))
+							shell_has_exited = TRUE;
+					}
                                         if (STREQ(name, lookfor) &&
                                             ((atoi(p_pid) == getpid()) ||
 				             (atoi(p_pid) == pc->pipe_shell_pid)
@@ -778,11 +782,15 @@
 		closedir(dirp);
         }
 
-	if (!pc->pipe_pid && ((retries++ < 10) || pc->pipe_shell_pid)) {
+	if (!pc->pipe_pid && !shell_has_exited && 
+	    ((retries++ < 10) || pc->pipe_shell_pid)) {
 		stall(1000);
 		goto retry;
 	}
-		
+
+	console("getpid: %d pipe_shell_pid: %d pipe_pid: %d\n",
+		getpid(), pc->pipe_shell_pid, pc->pipe_pid);
+
 	if (pc->pipe_pid)	
 		return pc->pipe_pid;
 
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Home]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Red Hat 9 Bible]     [Fedora Bible]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

Add to Google

Powered by Linux