I'm running pyro 4.31. I need to be able to catch an exception when the proxy object loses connection to the remote object (i.e. when the server abruptly shuts down).
So I have code like this:
for ...
proxy = Pyro4.async(Pyro4.Proxy(pyro_uri))
future_result[i] = proxy.run()
... some other code
for ....
try:
future_result[i].wait()
except ConnectionClosedError:....
At some point this worked and a ConnectionClosedError was thrown in case the connection was lost, but now it just keeps hanging on the wait command even if the server is down. I looked in de Pyro4 code and I must say I don't see how a loss of connection can unblock the wait command as the wait command waits until the Event boolean is set to True which is quite impossible to do when the server is down. If the server is still up, but I shutdown the pyro daemon and abruptly kill the ongoing process then a connection closed error is thrown, but I want it when the entire server goes down.
Not using async object this still gives the same problem (just hangs):
proxy=Pyro4.Proxy(pyro_uri)
try: rs=proxy.run(mms)
except ConnectionClosedError: print "connection closed"
except TimeoutError: print "timeout error"
except CommunicationError: print "communication closed"
print "finished"
print str(rs)
So how can I detect when connection is lost?