[execnet-dev] channel.receive() fails after a particular remote function is executed
Rick Gerkin
rick1 at gerkin.org
Wed Apr 24 14:26:44 CEST 2013
Thanks! It works now using the socket server:
gateway = execnet.makegateway("socket=127.0.0.1:8888")
It still doesn't work using popen, but that's fine. Also, is this supposed
to do the same thing?
gateway = execnet.SocketServer("127.0.0.1:8888")
It's in the example (
http://codespeak.net/execnet/example/test_info.html#instantiate-gateways-through-sockets
), but doesn't actually work because SocketServer takes two arguments.
Rick
On Wed, Apr 24, 2013 at 12:17 AM, Ronny Pfannschmidt <
Ronny.Pfannschmidt at gmx.de> wrote:
> HI Rick,
>
> it would be important to know the effects of the java code,
> if it ends up printing some output, it can interrupt the execnet io thats
> using stdio to transport the messages
>
> instead of using the normal popen gateway i suggest you try the
> socketserver on jython.
>
> then the execnet io is on a socket and you can see what will happen to the
> normal stdio on the console
>
> -- Ronny
>
>
> On 04/24/2013 12:26 AM, Rick Gerkin wrote:
>
>> My code amounts to this:
>>
>> def jython_side(channel,**kwargs):
>> import foo
>> foo()
>> channel.send([1.0,2.0,3.0])
>>
>> import execnet
>> gw = execnet.makegateway("popen//**python=jython")
>> channel = gw.remote_exec(jython_side)
>> channel.receive()
>> run in a python interpreter, where foo() is a function which imports and
>> calls java code (in jython), and which I can confirm runs without
>> problems in a jython interpreter.
>>
>> If I set EXECNET_DEBUG=2, I get this:
>>
>> [35284] gw0-slave RECEIVERTHREAD: starting to run
>> [35284] gw0-slave execution starts[1]: u'def
>> jython_side(channel,**kwargs):**\n
>> [35284] gw0-slave calling jython_side(**{})
>> [35284] gw0-slave sent <Message.CHANNEL_DATA channelid=1 [1.0, 2.0, 3.0]>
>> [35284] gw0-slave execution finished
>> [35284] gw0-slave 1 sent channel close message
>>
>> and the final channel.receive()line hangs.
>>
>>
>> However, if I comment out foo(), I get this:
>>
>> [35262] gw0-slave RECEIVERTHREAD: starting to run
>> [35262] gw0-slave execution starts[1]: u'def
>> jython_side(channel,**kwargs):**\n
>> [35262] gw0-slave calling jython_side(**{})
>> *[35241] gw0 received <Message.CHANNEL_DATA channelid=1 [1.0, 2.0, 3.0]>*
>>
>> [35262] gw0-slave sent <Message.CHANNEL_DATA channelid=1 [1.0, 2.0, 3.0]>
>> [35262] gw0-slave execution finished
>> [35262] gw0-slave 1 sent channel close message
>>
>> and the final channel.receive()line returns [1.0,2.0,3.0]as expected.
>>
>>
>> So it appears that simply calling foo() in the "slave" causes the
>> "master" to lose the ability to receive a message sent from the "slave".
>> I can add other things after foo() in this code and see their results,
>> so I know that foo() itself is not hanging.
>>
>> Any thoughts on why this is happening, or how to debug this? The java
>> in foo()is a lot of code that I didn't write, so unless there is some
>>
>> reason to suspect a particular operation there, I'm not sure where to
>> look. Also, I don't think this is supposed to happen no matter what the
>> contents of foo()are.
>>
>> Thanks,
>> Rick
>>
>>
>>
>>
>> ______________________________**_________________
>> execnet-dev mailing list
>> execnet-dev at python.org
>> http://mail.python.org/**mailman/listinfo/execnet-dev<http://mail.python.org/mailman/listinfo/execnet-dev>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/execnet-dev/attachments/20130424/157c3f18/attachment.html>
More information about the execnet-dev
mailing list