Thread dump during build with ctrl-\

Mike Duigou mike.duigou at oracle.com
Thu Feb 20 18:57:57 UTC 2014


I've tried John's suggestion and it helps but is not enough. I believe I would have to trap the outer make invocation as well. Unfortunately wrapping make in a script just to be able to to use ctrl-\ is probably not worth it.

I'm instead using jstack though it can be harder to get timing right. 

Mike

diff -r b88cdacd404a common/bin/logger.sh
--- a/common/bin/logger.sh      Tue Jan 28 20:09:25 2014 +0000
+++ b/common/bin/logger.sh      Thu Feb 20 10:33:46 2014 -0800
@@ -41,5 +41,5 @@
 trap "rm -rf \"$RCDIR\"" EXIT
 LOGFILE=$1
 shift
-(exec 3>&1 ; ("$@" 2>&1 1>&3; echo $? > "$RCDIR/rc") | tee -a $LOGFILE 1>&2 ; exec 3>&-) | tee -a $LOGFILE
+(exec 3>&1 ; ( trap '' QUIT; "$@" 2>&1 1>&3; echo $? > "$RCDIR/rc") | sh -c "trap '' QUIT; tee -a $LOGFILE 1>&2" ; exec 3>&-) | sh -c "trap '' QUIT; tee -a $LOGFILE"
 exit `cat "$RCDIR/rc"`

On Feb 6 2014, at 17:50 , John Rose <john.r.rose at oracle.com> wrote:

> On Feb 4, 2014, at 10:48 PM, David Holmes <david.holmes at oracle.com> wrote:
> 
>> I don't see how make and all the intervening shells could know to pass the signal through to the JVM process. ??
> 
> IIRC they don't need to pass the signal, because the signal goes from the tty to the current group of processes.  A waiting shell or make probably disregards such signals and pays more attention to the response to the thing it is waiting for.  In this case, perhaps the "tee" command gets sick from the signal and causes the pipeline to fail.  Perhaps the "tee" command needs to be wrapped in some kind of trappy thing like:  sh -c 'trap "" 2 3; tee'
> 
> — John




More information about the build-dev mailing list