[Twisted-Python] pb.Referenceable: wxPython client crash and server exceptions

Ruslan Spivak alienoid at is.lg.ua
Tue Oct 7 02:46:45 MDT 2003


Hello.

I have wxPython clients (twisted on windows XP) and twisted ssl 
server(RH linux 8.0).

Clients connect to server and passes their pb.Referenceable. Server 
every minute calls clients remote methods.
After 8-9 hours of continuous work client crashes(it's compiled into 
windows .exe with py2exe) and in my twistd.log i see such lines:

2003/10/07 05:46 EEST [Broker,2,192.168.100.254] Unhandled error in 
Deferred:
2003/10/07 05:46 EEST [Broker,2,192.168.100.254] Traceback from remote 
host -- Traceback (most recent call last):
           File "twisted\spread\banana.pyc", line 320, in dataReceived

           File "twisted\spread\banana.pyc", line 93, in 
callExpressionReceived

           File "twisted\spread\pb.pyc", line 511, in expressionReceived

           File "twisted\spread\pb.pyc", line 822, in proto_message

         --- <exception caught here> ---
           File "twisted\spread\pb.pyc", line 836, in _recvMessage

           File "twisted\spread\flavors.pyc", line 118, in 
remoteMessageReceived

           File "<string>", line 55, in remote_checkpoint

         exceptions.IOError: [Errno 9] Bad file descriptor




My client code excerpt:

class Client(pb.Referenceable):
     def remote_checkpoint(self):
         print "client"


class MyFrame(wxFrame, TaskBarApp):
     ...

     def gotObject(self, object):
         self.server = object
         object.notifyOnDisconnect(self.disconnected)
         d = object.callRemote("connect", self.conf.getUsername(),
                             self.conf.getPassword(),
                             self.conf.getIP(),
                             self.conf.getNetmask(),
                             self.conf.getMAC(),
                             Client())
         d.addCallbacks(self.connected, self.gotError)

     def OnConnect(self, event=None):
         bf = pb.PBClientFactory()
         from twisted.internet import ssl
         contextFactory = ssl.ClientContextFactory()
         reactor.connectSSL(SERVER_IP, SERVER_PORT, bf, contextFactory, 30)
         d = bf.getRootObject()

         d.addCallbacks(self.gotObject, self.gotError)


class MyApp(wxApp):
     def OnInit(self):
         wxInitAllImageHandlers()
         self.frame = MyFrame(NULL, -1, lang.appLabel)
         self.frame.Show(true)
         self.SetTopWindow(self.frame)
         return true

app = MyApp(0)
wxsupport.install(app)
if app.frame.isAutoconnected():
     app.frame.OnConnect()
#on Windows platfom we need to run with installSignalHandlers=0
if wxPlatform == '__WXMSW__':
     reactor.run(installSignalHandlers=0)
else:
     reactor.run()


Can you suggest something?
Your help is very appreciated.
Thanks in advance.

P.S. Twisted1.0.7

Best regards,
Ruslan





More information about the Twisted-Python mailing list