Thread dump during build with ctrl-\

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Thu Feb 20 20:58:59 UTC 2014


On 2014-02-20 19:57, Mike Duigou wrote:
> 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.

If what you need to wrap make is something like
#!/bin/bash
sh -c "trap '' QUIT; make "$@"
and that, combined with the patch below, does help you achieve what you 
want, maybe you can create a common/bin/make_wrapper.sh with that code? 
That way, the wrapper is there if you need it, otherwise you can ignore it.

/Magnus

>
> 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