[Twisted-Python] Moderately-long running processes timing out in Twisted

Steve Lewis spiritualmechanic at yahoo.com
Fri Sep 5 14:06:25 EDT 2008

I looked at the adbapi code and it appears the ConnectionLost exception is coming from there, not from cx_Oracle. At least that's what is in the error log:

2008-09-05 12:25:48-0400 [HTTPChannel,9003,] adbapi closing: cx_Oracle
2008-09-05 12:25:48-0400 [HTTPChannel,9003,] Connection lost.
2008-09-05 12:25:48-0400 [-] Unhandled Error
        Traceback (most recent call last):
          File "/opt/Python25/lib/python2.5/threading.py", line 440, in run
            self.__target(*self.__args, **self.__kwargs)
          File "/opt/python/lib/python2.5/site-packages/twisted/python/threadpool.py", line 161, in _worker
            context.call(ctx, function, *args, **kwargs)
          File "/opt/python/lib/python2.5/site-packages/twisted/python/context.py", line 59, in callWithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/opt/python/lib/python2.5/site-packages/twisted/python/context.py", line 37, in callWithContext
            return func(*args,**kw)
        --- <exception caught here> ---
          File "/opt/python/lib/python2.5/site-packages/twisted/internet/threads.py", line 24, in _putResultInDeferred
            result = f(*args, **kwargs)
          File "/opt/python/lib/python2.5/site-packages/twisted/enterprise/adbapi.py", line 380, in _runInteraction
          File "/opt/python/lib/python2.5/site-packages/twisted/enterprise/adbapi.py", line 65, in rollback
            raise ConnectionLost()

I don't know what 

        --- <exception caught here> ---

means. I'm guessing there's some sort of issue with Oracle but our DBA didn't see anything obvious in his logs. Is there a way for me to tell what exactly the "exception caught here" is?


----- Original Message ----
From: L. Daniel Burr <ldanielburr at mac.com>
To: Twisted general discussion <twisted-python at twistedmatrix.com>
Sent: Friday, September 5, 2008 1:15:40 PM
Subject: Re: [Twisted-Python] Moderately-long running processes timing out in Twisted

Hi Steve,

On Fri, 05 Sep 2008 11:51:15 -0500, Steve Lewis  
<spiritualmechanic at yahoo.com> wrote:

> We're trying to use twisted as a sort of bus, a centralized place to  
> manage all of our SOA enpoints (mostly through XML-RPC). We have a few  
> services that access the Oracle DB directly (adbapi). In production  
> we're getting intermittent ConnectionLost exceptions from cx_Oracle.  
> Most of these are queries that take a couple of seconds.

Hmm, it is kind of hard to say what the problem could be, without
seeing the code that is using adbapi and cx_Oracle.

When you say you are receiving ConnectionLost exceptions from cx_Oracle,
are they *really* from cx_Oracle, i.e., "ORA-03135 - Connection lost...",
or are they just the result of adbapi calling its connectionLost method?

> Has anyone seen this kind of behavior before? What we're probably going  
> to do in the short term is just remove twisted from the equation for  
> these methods that seem to be timing out. But we're relatively new to  
> twisted and I wonder if we're doing something that's obviously wrong.

I've used cx_Oracle with twisted many times, with many different workloads,
including stored procedures with OUT parameters, and it has always worked
as expected.  If you are able to provide some code, this list might be
able to provide you with more prescriptive advice.

Hope this helps,

L. Daniel Burr

Twisted-Python mailing list
Twisted-Python at twistedmatrix.com


More information about the Twisted-Python mailing list