On Wed, Mar 26, 2014 at 10:19 PM, Richard Oudkerk <[email protected]>wrote:

> On 26/03/2014 5:25pm, Guido van Rossum wrote:
>
>> - Looks like the signal handler is somehow inherited by the subprocess
>> created for the process pool?
>>
>
> It looks like ProcessPoolExecutor creates its workers lazily, so after you
> have changed the signal handlers for the main process.  The workers are
> created using multiprocessing, which uses fork on Unix (at least by
> default), so they inherit the signal handlers.
>
> You might try submitting a dummy task before modifying the signal handlers
> (although that will not help much if the workers have to be restarted).
>
> In Python 3.4 you might try using
>
>     multiprocessing.set_start_method('spawn')
>
> or
>
>     multiprocessing.set_start_method('forkserver')
>
> This hopefully prevents the workers from inheriting anything troublesome
> from the main process.
>
> -- Richard
>

Thanks for chiming in.
That did help raising an exception but not in the worker code from which it
appears I cannot catch KeyboardInterrupt (actually I can't catch it from
anywhere).
I get different exceptions every time, all generating form multiprocessing
code.
Will keep digging further and hopefully update this thread in case I find a
solution.


-- 
Giampaolo - http://grodola.blogspot.com

Reply via email to