[ccache] ccache interrupt handling bug

Mike Frysinger vapier at gentoo.org
Wed Aug 19 13:45:46 UTC 2015


On 17 Aug 2015 21:08, Joel Rosdahl wrote:
> Nadav Har'El <nyh at cloudius-systems.com> wrote:
> 
> > [...] Your patch makes ccache exit as soon as it gets the SIGINT - but the
> > child compiler might still be running for a while longer. This will usually
> > be fine, but I thought the user can be surprised if he sees ccache (which
> > he considers to be the compiler) exit, but "ps" shows the compiler is still
> > running. This would be especially annoying if some hypothetical compiler
> > trapped SIGINT deliberately, and continued to run long after ccache exits.
> 
> 
> Right, I understand where you're coming from. Thanks for clarifying your
> approach.
> 
> However, letting ccache's signal handler not exit is not an option since
> that would make it impossible to cancel ccache if the signal is caught when
> ccache is not running a compiler. One noteworthy code path that can take
> lots of time is performing cache cleanup – it can easily take many minutes
> on large, cold caches. ccache's signal handler is relatively new; it was
> added only recently to delete some temporary files before exiting. The
> missing _exit(1) call was simply an oversight, so I just restored the
> behavior to what it has been for a long time: exiting almost immediately on
> a signal (i.e., not waiting for any child process to exit).
> 
> Your patch makes ccache exit as soon as it gets the SIGINT - but the child
> > compiler might still be running for a while longer. This will usually be
> > fine, but I thought the user can be surprised if he sees ccache (which he
> > considers to be the compiler) exit, but "ps" shows the compiler is still
> > running. This would be especially annoying if some hypothetical compiler
> > trapped SIGINT deliberately, and continued to run long after ccache exits.
> 
> 
> I agree that it would be preferable to wait for the compiler if it's
> running. I think that the proper way to do that would be to waitpid()
> inside the signal handler and then _exit().

this wouldn't solve things entirely.  calling _exit(1) is fundamentally wrong.
here's a pretty good page giving a rundown:
	http://www.cons.org/cracauer/sigint.html
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.samba.org/pipermail/ccache/attachments/20150819/12c14bd4/signature.sig>


More information about the ccache mailing list