Hello from a new list member! I'm evaluating Twisted for use in my company's product, and I'm currently stuck on a problem that I don't know how to debug.<br><br>I am creating an XMLRPC server that uses twisted.enterprise.adbapi
to query a database. The symptom I've seeing is that the *third* call to an xmlrpc method that queries the database delays for some time (a minute or so) before returning with the correct results. The first two calls always return very quickly. Calls after the third one usually return quickly as well.
<br><br>I've narrowed down the code as far as I can, and I'm not sure what to check next. Any help would be appreciated. Here's what I've found so far (complete code is at the bottom of the email):<br><br>1) Not using the XMLRPC server, just using
reactor.callLater() to run the query, then calling callLater again in the callback results in the query getting run over and over and I never see a delay. So I suspected the XMLRPC server code.<br><br>2) Calling XMLRPC methods that don't use the dbpool always return quickly. So I suspected the adbapi code.
<br><br>3) Changing the cp_min argument to ConnectionPool's constructor can change the behavior - making it larger than 3 results in the third call being delayed, then the fourth call getting error 8002 back from the server.
<br><br>4) I've tried adodbapi as well as the eval version of mxODBC just to make sure it wasn't the db driver - the behavior is identical in both cases.<br><br>Any ideas? Thanks in advance,<br>Sean<br><br>---<br>from twisted.internet
import reactor<br>from twisted.web import xmlrpc
<br>from twisted.enterprise import adbapi <br> <br>class ReportRunner(xmlrpc.XMLRPC): <br> def __init__(self):
<br> self.dbpool = adbapi.ConnectionPool("mx.ODBC.Windows", "dsn","user","pwd")<br><br> def xmlrpc_test(self):<br> return self.dbpool.runQuery("select 1")
<br> <br> def xmlrpc_quit(self):<br> reactor.callLater(1, reactor.stop)<br> return "OK" <br> <br>def main(): <br> from twisted.web import server<br> r = ReportRunner()
<br>
reactor.listenTCP(7080, server.Site(r))<br> reactor.run()<br><br><br>if __name__ == '__main__':<br> main()<br><br><br><br><br>