Re: ccache interrupt handling bug

Mike Frysinger <[email protected]> Wed, 19 Aug 2015 09:45:46 -0400
Newsgroups gmane.comp.compilers.ccache
Message-ID <20150819134546.GB1584@vapier>
On 17 Aug 2015 21:08, Joel Rosdahl wrote:
> Nadav Har'El <[email protected]> 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

_______________________________________________
ccache mailing list
[email protected]
https://lists.samba.org/mailman/listinfo/ccache
signature.asc (application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJV1IiKAAoJEEFjO5/oN/WBiuAP/jp63L2w/MCBaXVIYkpl7bdT
q+Ceod2o9MAoOisWwIa2DoaYfazmlnPSMtvIYgkYVMKI24fpFGewFg4upfNZM3bt
pGzt+DCfoC8FXgH+VWbuOEM/ABk0LaAc4I81GwKlxINA7IgmNTQft/0SLz5XY/BJ
id2QNuxI8g1ul8jkc5vXAfTe3aOzRa5/s6DQ+RsNYDosakaQhF9DvOl+R+XrRkSn
7tUHJn9TkwyquQh8CSMGOUnniUtzkB0vF2tYcH7RX7KDBerdLT8IajT3VMpPSq48
mpXh/0LtH6oP7zdGWo6vNItTXGxkih/8NGTaWxXAAMKtp9s+w8xih11Q0Z6ukbmF
2GIPKmfXXiLg/TtmI1zs5jmqswQKBy+QHICbUSdoP3JOHfPmRIZP5plKC7GvgjG2
Vii0L0dfEZajkkK8lvYpQHyUANG1nTAcxfW7NJYClaxkEaBvDqodyqSfAvryaDRa
z6Ftw8csBzG09CsyadlzNTEdt+FwxCHm9P/BB0LpQlhvHBvpJskA2YeHygXWsd2e
fqDMwJStR9dqQR80JbSV29lrS0DPdgtexqo8WN/E8BnldxPo36Cpgmqppv5MO8l2
sLhCf+pyLC40FQz/Z5ed32Rsye6hWMSPT8MdmjxchK+1Xes0p+ExJ6R5wCoIhEtq
sTW8lfdl40D0xbAT4GVC
=OBJu
-----END PGP SIGNATURE-----