[execnet-dev] closing channels and gateways

holger krekel holger at merlinux.eu
Fri Nov 6 18:42:38 CET 2009


Hi Jacob, 

On Fri, Nov 06, 2009 at 08:05 -0800, Jacob Perkins wrote:
> Do channels or gateways need to be explicitly closed before a script
> finishes?

Usually not.  But automatic teardown is a bit involved, tied to GC and __del__,
not tested yet for all situations.  

> When I registered an atexit function to close them (calls close() on each
> channel, then exit() on each gateway), I get the following:
> 
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
>   File "<string>", line 979, in <module>
>   File "<string>", line 688, in serve
>   File "<string>", line 717, in executetask
>   File "<string>", line 384, in close
>   File "<string>", line 641, in _send
>   File "<string>", line 185, in writeto
>   File "<string>", line 884, in save
>   File "<string>", line 161, in write
> ValueError: I/O operation on closed file

Is this execnet-1.0.0b2? (see execnet.__version__). 
Is it part of a "RemoteError", i.e. a traceback-representation from remote?

This traceback comes from a process that finished executing 
a "remote_exec(source)" source code.  It tries to send
a "close" message but the IO connection is already dead. 
This shouldn't happen in an automatic teardown, i'd say. 
So it's a bug - if you somehow find a script to reproduce it
that'd be very helpful.

With http://codespeak.net/execnet/trunk/basics.html#debugging-execnet
you can get some trace-files of the several processes to see
what is going on. 
 
> Thanks (and huge thanks for creating execnet, it's simpler and far more
> efficient for my purposes than discoproject)

nice to hear!  What's your use case if i may ask? 

best,
holger

--
twitter: http://twitter.com/hpk42
contracting: http://merlinux.eu 



More information about the execnet-dev mailing list