Re: hang observed using Pyro4

Arend van Spriel <[email protected]> Sat, 23 May 2015 12:20:59 +0200
Newsgroups gmane.comp.python.pyro
Message-ID <[email protected]>
On 23-05-15 11:23, Arend van Spriel wrote:
> On 23-05-15 00:00, Irmen de Jong wrote:
>> On 22-5-2015 19:57, Arend van Spriel wrote:
>>> I am thinking about using Pyro4 in a testing framework with a controller
>>> accessing objects on DUT (device under test). The package for the
>>> objects on the DUT are on GitHub [1]. I have a pyro-experiment branch
>>> there.
>>>
>>> As experiment I create a server object (in lib/server.py) which exposes
>>> a create_instance() method through which the client can request the
>>> creation of a particular class on the server, which is registered with
>>> the Daemon and returned. The requested class instance may create other
>>> custom objects which are also registered with the Daemon. The result is
>>> an object hierarchy with Proxy objects. So far so good. In my experiment
>>> the client (in examples/example06.py) accesses those Proxy objects to
>>> show data in terminal. However, it hangs after a couple of Proxy calls
>>> on socket recv.
>>
>> What hangs, client? server?
>>
>>> I also tried with USE_MSG_WAITALL set to False, but the
>>> result is the same. The experiment is done with client and server on the
>>> same machine. Any suggestions about what might be going on or how to
>>> debug this would be appreciated.
>>
>> Enable pyro logging and see what's happening in there.
>>
>> Are you by any chance using gevent to monkeypatch socket stuff?
>> What OS/python are you running this on?
>>
>>
>> Do you also observe similar issues when running any of the examples
>> that come with Pyro?
>
> I ran the autoproxy example and slightly modified it to match my
> use-case. Each Thingy has list of 20 SubThingy that I iterate through on
> client side and make it speak. It hangs on item 13 in the list. Same in
> my use-case (exactly on item 13).
>
> server output
>
> Thingy 1 says: I am the first
> Thingy 2 says: I am second
> Thingy 3 says: I am last then...
> SubThingy 1.1 says: I am also here!!
> SubThingy 1.2 says: I am also here!!
> SubThingy 1.3 says: I am also here!!
> SubThingy 1.4 says: I am also here!!
> SubThingy 1.5 says: I am also here!!
> SubThingy 1.6 says: I am also here!!
> SubThingy 1.7 says: I am also here!!
> SubThingy 1.8 says: I am also here!!
> SubThingy 1.9 says: I am also here!!
> SubThingy 1.10 says: I am also here!!
> SubThingy 1.11 says: I am also here!!
> SubThingy 1.12 says: I am also here!!
>
> Attached is my modified autoproxy and the pyro logging. It can not
> establish the connection to SubThingy #13.

In the modified autoproxy client.py I added follow which resulted in 
hang issue:

for subthing in thing1.subs:
	print("%s:" % subthing.number)
	subthing.speak("I am also here!!")

So next I tried with client.py doing following for SubThingy #13:

subthing = thing1.subs[12]
for i in range(15):
	print("%s speaking." % subthing.number)
	subthing.speak("I am also here!!")

This works fine. So now trying another approach:

for i in range(len(thing1.subs)):
	subthing = thing1.subs[i]
	print("%s speaking." % subthing.number)
	subthing.speak("I am also here!!")

Luck. This works as well. Not sure what the deal is here. Could it be 
number of open socket connections?

Regards,
Arend

> Regards,
> Arend

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y