Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Problems with trap handling?



On Feb 2,  4:30pm, Sven Wischnowsky wrote:
} Subject: Re: Problems with trap handling?
}
} James Kirkpatrick wrote:
} 
} > I've slowly (too slowly!) been working with Bart Schaefer since around
} > November to determine the nature of a loop that occurs if you turn on
} > history files.  It appears that (for example) a disconnect (hangup) causes
} > zsh to loop in a manner where it consumes all available memory, severely
} > impacting other users, until it presumably finally aborts.  Putting a
} >   TRAPHUP () { exit 1 }
} > works around the problem but I need to try a patch Bart sent me as well.
} 
} Hm, I think I vaguely remember the problem you described (unless you
} never posted it to the list, in which case I vaguely remember
} something completely different). Dunno if it has anything to do with
} the bugs I'm trying to fight... (but I don't think so, I would need to 
} know where it hangs).

It appears to be repeatedly calling a signal handler.  I'm not able to
reproduce the bug on my Linux box.

Following is the patch to which James referred.  It simply makes sure that
zsh doesn't HUP itself when exiting.  It seems like a reasonable enough
precaution.

Index: Src/signals.c
===================================================================
@@ -540,7 +540,8 @@
         if ((from_signal || i != thisjob) && (jobtab[i].stat & STAT_LOCKED) &&
             !(jobtab[i].stat & STAT_NOPRINT) &&
             !(jobtab[i].stat & STAT_STOPPED)) {
-            if (killpg(jobtab[i].gleader, SIGHUP) != -1)
+            if (jobtab[i].gleader != getpid() &&
+		killpg(jobtab[i].gleader, SIGHUP) != -1)
                 killed++;
         }
     if (killed)

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author