I had the case where on_exit() was never called because proc had no value and therefore the attempt to pass proc.pid to on_exit caused an exception before on_exit was called. As a result, the mater thread was waiting its children threads forever, as these child never signaled that they finished.
work related to [https://bugzilla.ipr.univ-rennes.fr/show_bug.cgi?id=3372]