[Zope] Thread issue? Should I popen?

Thomas B. Passin tpassin@mitretek.org
Tue, 28 May 2002 10:14:00 -0400


[Scott Burton]

> Hello all, I am having a external method problem. In Zope I added an
external method object which is a simple list sorting script. The script
sorts a list, loads a class instance which does a socket connection over ssl
and returns a response. Easy enough, but... when the ext method is called
from Zope it takes about a minute to return a response and the CPU usage
goes up to 100% the entire time. However, when I run the same script from
the python interpreter, it does its business and returns in about a second.
Running the list sorting ext method from Zope without the extra class
instance returns my list in .01 seconds.
>
> So, I am asuming it is a thread issue with Zope and my socket connection
class? Should I open another Python process to do the socket connection
using popen? Should I increase the thread count in Zope? (It didn't seem to
make much difference running at 8thds vs. 4thds BTW). Should I attempt to
run the class in its own thread?
>

This sounds very strange to me.  I run multiple connections from an external
method using urllib (which uses sockets, of course) and don't see that
problem (Windows 2000, Zope 2.3.3).  That's not using ssl, though.

Maybe something else is going on.  Can you comment out the socket connection
and return a dummy response?  If so, do you still get the minute's delay or
a quick return?  Can you be sure that the socked is opened with the same
parameters using the interpreter as whe called from Zope?  I wonder if
somehow the ssl authentication is getting interfered with by Zope, though I
don't see why.

Also, even if you run it in a thread, the thread calling routine will still
have to wait for the thread to return, so it's possible you won't actually
gain much.

Could you say which OS and Zope version you are using, in case they ring a
bell for someone?

Cheers,

Tom P