Pyro4 does not throw ConnectionClosedError
<dieter-eJWuXbj/[email protected]> Sun, 29 Mar 2015 19:39:12 GMT
| Newsgroups | gmane.comp.python.pyro |
|---|---|
| Message-ID | <1427657952594.101054.19070@webmail6> |
This is a multipart message in MIME format. --===============9092332527545379243== Content-Type: multipart/alternative; boundary="----------19068-1427657952594-1" This is a multipart message in MIME format. ------------19068-1427657952594-1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Hi, I'm running pyro 4.31 and use it on my amazon ec2 instances. I'm mainly run= ning spot price instances which means I often have to deal with a server th= at goes down. So I need to be able to catch an exception when the my proxy = object loses connection to the remote object. So I have code similar to for ...proxy =3D 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 th= e connection was lost, but now it just keeps hanging on the wait command ev= en 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 comma= nd waits until the Event boolean is set to True which is quite impossible t= o do when the server is down. So how can I best detect when connection is l= ost? If the server is still up, but I shutdown the pyro daemon then a conne= ction closed error is thrown, but I want it when the entire server goes dow= n. EDIT:it seems that python's recv function does not throw an error which mig= ht be the underlying cause why no error is thrown in Pryo4 either? Best regards, Dieter Devlaminck ------------19068-1427657952594-1 Content-Type: multipart/related; boundary="----------19068-1427657952594-2" ------------19068-1427657952594-2 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8 <span style=3D"color: rgb(34, 34, 34); font-family: arial, sans-serif; font= -size: 12.8000001907349px; background-color: rgb(255, 255, 255);">Hi,=C2= =A0</span><div style=3D"color: rgb(34, 34, 34); font-family: arial, sans-serif= ; font-size: 12.8000001907349px; background-color: rgb(255, 255, 255);"><br= /></div><div style=3D"color: rgb(34, 34, 34); font-family: arial, sans-ser= if; font-size: 12.8000001907349px; background-color: rgb(255, 255, 255);">I= 'm running pyro 4.31 and use it on my amazon ec2 instances. I'm mainly runn= ing spot price instances which means I often have to deal with a server tha= t goes down. So I need to be able to catch an exception when the my proxy o= bject loses connection to the remote object.</div><div style=3D"color: rgb(= 34, 34, 34); font-family: arial, sans-serif; font-size: 12.8000001907349px;= background-color: rgb(255, 255, 255);"><br /></div><div style=3D"color: rg= b(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8000001907349p= x; background-color: rgb(255, 255, 255);">So I have code similar to</div><d= iv style=3D"color: rgb(34, 34, 34); font-family: arial, sans-serif; font-si= ze: 12.8000001907349px; background-color: rgb(255, 255, 255);"><br /></div>= <div style=3D"color: rgb(34, 34, 34); font-family: arial, sans-serif; font-= size: 12.8000001907349px; background-color: rgb(255, 255, 255);">for ...</d= iv><div style=3D"color: rgb(34, 34, 34); font-family: arial, sans-serif; fo= nt-size: 12.8000001907349px; background-color: rgb(255, 255, 255);">=C2=A0 = proxy =3D Pyro4.async(Pyro4.Proxy(pyro_<wbr>uri))<br /></wbr></div><div sty= le=3D"color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12= .8000001907349px; background-color: rgb(255, 255, 255);">=C2=A0 future_resu= lt[i].proxy.run()</div><div style=3D"color: rgb(34, 34, 34); font-family: a= rial, sans-serif; font-size: 12.8000001907349px; background-color: rgb(255,= 255, 255);">... some other code</div><div style=3D"color: rgb(34, 34, 34);= font-family: arial, sans-serif; font-size: 12.8000001907349px; background-= color: rgb(255, 255, 255);">for ....</div><div style=3D"color: rgb(34, 34, = 34); font-family: arial, sans-serif; font-size: 12.8000001907349px; backgro= und-color: rgb(255, 255, 255);">try:</div><div style=3D"color: rgb(34, 34, = 34); font-family: arial, sans-serif; font-size: 12.8000001907349px; backgro= und-color: rgb(255, 255, 255);">=C2=A0 future_result[i].wait()</div><div st= yle=3D"color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 1= 2.8000001907349px; background-color: rgb(255, 255, 255);">except Connection= ClosedError:....</div><div style=3D"color: rgb(34, 34, 34); font-family: ar= ial, sans-serif; font-size: 12.8000001907349px; background-color: rgb(255, = 255, 255);"><br /></div><div style=3D"color: rgb(34, 34, 34); font-family: = arial, sans-serif; font-size: 12.8000001907349px; background-color: rgb(255= , 255, 255);">At some point this worked and a ConnectionClosedError was thr= own in case the connection was lost, but now it just keeps hanging on the w= ait command even if the server is down. I looked in de Pyro4 code and I mus= t 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 quit= e impossible to do when the server is down. So how can I best detect when c= onnection is lost? If the server is still up, but I shutdown the pyro daemo= n then a connection closed error is thrown, but I want it when the entire s= erver goes down.</div><div style=3D"color: rgb(34, 34, 34); font-family: ar= ial, sans-serif; font-size: 12.8000001907349px; background-color: rgb(255, = 255, 255);"><br /></div><div style=3D"color: rgb(34, 34, 34); font-family: = arial, sans-serif; font-size: 12.8000001907349px; background-color: rgb(255= , 255, 255);">EDIT:<span style=3D"font-size: 12.8000001907349px;">=C2=A0it = seems that python's recv function does not throw an error which might be th= e underlying cause why no error is thrown in Pryo4 either?</span></div><div= style=3D"color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size= : 12.8000001907349px; background-color: rgb(255, 255, 255);"><br /></div><d= iv style=3D"color: rgb(34, 34, 34); font-family: arial, sans-serif; font-si= ze: 12.8000001907349px; background-color: rgb(255, 255, 255);">Best regards= ,</div><div style=3D"color: rgb(34, 34, 34); font-family: arial, sans-serif= ; font-size: 12.8000001907349px; background-color: rgb(255, 255, 255);">Die= ter Devlaminck</div> ------------19068-1427657952594-2-- ------------19068-1427657952594-1-- --===============9092332527545379243== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ --===============9092332527545379243== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Pyro-core mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyro-core --===============9092332527545379243==--