From rick1 at gerkin.org Wed Apr 24 00:26:56 2013 From: rick1 at gerkin.org (Rick Gerkin) Date: Tue, 23 Apr 2013 15:26:56 -0700 Subject: [execnet-dev] channel.receive() fails after a particular remote function is executed Message-ID: 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 [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 * [35262] gw0-slave sent [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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Ronny.Pfannschmidt at gmx.de Wed Apr 24 09:17:36 2013 From: Ronny.Pfannschmidt at gmx.de (Ronny Pfannschmidt) Date: Wed, 24 Apr 2013 09:17:36 +0200 Subject: [execnet-dev] channel.receive() fails after a particular remote function is executed In-Reply-To: References: Message-ID: <51778710.5050308@gmx.de> 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 > [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 * > [35262] gw0-slave sent > [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 From rick1 at gerkin.org Wed Apr 24 14:26:44 2013 From: rick1 at gerkin.org (Rick Gerkin) Date: Wed, 24 Apr 2013 05:26:44 -0700 Subject: [execnet-dev] channel.receive() fails after a particular remote function is executed In-Reply-To: <51778710.5050308@gmx.de> References: <51778710.5050308@gmx.de> Message-ID: 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 >> [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 * >> >> [35262] gw0-slave sent >> [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 >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Ronny.Pfannschmidt at gmx.de Wed Apr 24 15:47:05 2013 From: Ronny.Pfannschmidt at gmx.de (Ronny Pfannschmidt) Date: Wed, 24 Apr 2013 15:47:05 +0200 Subject: [execnet-dev] channel.receive() fails after a particular remote function is executed In-Reply-To: References: <51778710.5050308@gmx.de> Message-ID: <5177E259.6010309@gmx.de> Hi Rick, execnet.SocketServer has been deprecated since a while, you are supposed to use makegateway i made a bts task about fixing the docs on https://bitbucket.org/hpk42/execnet/issue/12/kill-documentation-about-the-deprecated we'll get to it later -- Ronny On 04/24/2013 02:26 PM, Rick Gerkin wrote: > 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 > > 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 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 2.0, 3.0]>* > > [35262] gw0-slave sent 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 > > > >