[Twisted-web] Xml-Rpc server troubles

Andrea Nicolini andrea at teamsw.it
Tue Nov 16 03:37:16 MST 2004


Hi All,

I'm trying to debug a XML-RPC server I wrote because sometimes it gets  
stuck and I don't know why.
I'm not a twisted expertise so I hope someone in this list can help me.

I use the server to give access to a MySql database via XML-RPC, the  
client are written in python and java.
The server runs fine for some days and then suddenly it hangs.
When the server hangs I can connect to the server port but when I call  
a remote method the server doesn't respond.
The server is not throwing any exception.
I'm running the server on a RH9 using Python 2.2 and Twisted 1.3.

Here's a snippet of code:


def xmlrpc_createjob(self,hash):
                tscmfuncs.call_debug(debug,foreground)
                d = self.dbpool.runInteraction(self.createjob,hash)
                return d.addCallback(self.returnData)

def createjob(self,cur,hash):
                """Method to create a new job -> returns the new job's  
id"""
                try:
                        qparam = ()
                        cur.execute('SELECT * FROM jobtable')
                        for field in cur.description:
                                f = field[0]
                                if hash.has_key(f):
                                        if type(hash[f]) == type(u''):
                                                qparam += (hash 
[f].encode('iso-8859-1'),)
                                        else:
                                                qparam += (hash[f],)
                                else:
                                        qparam += (None,)
                        cur.execute("INSERT INTO jobtable VALUES (%s,% 
s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,% 
s)",qparam)
                        cur.execute("SELECT LAST_INSERT_ID() FROM  
jobtable")
                        curid = cur.fetchone()[0]
                        cur.close()

                except Exception,err:
                        return 0
                else:
                        return curid


I don't have any idea of what can cause this behaviour and how to debug  
the server.
Any idea?

Thank you.
Bye.
-- 

Andrea Nicolini
mailto:andrea at teamsw.it
im:aser76 at jabber.linux.it
http://www.teamsw.it
Team Software S.r.l.
Via Campagna 30
Cognento MO
Tel 059.343790





More information about the Twisted-web mailing list