Re: [Modeling-users] Warning: possible problem with Zope, maybe MT-related
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2003-03-08 11:19:31
|
Jerome Kerdreux <Jer...@fi...> writes: > On Fri, Mar 07, 2003 at 10:53:08AM +0100, Sebastien Bigaret wrote: > >=20 > > It seems that the problem is triggered when the same psycopg cursor= is > > used in two different threads. >=20 >=20 > This is really sound strange as, i know zope use medusa asyncore, and= =20 > this avoid the use of thread (for the http..) so how could you achieve > to have several thread using the same db connection. ?=20 >=20 You made me doubt about this, but I checked and Zope does use threads indeed. I included at the end the short list of modules I visited to make sure: Zope uses the asyncore to dispatch its request (and, right, the dispatch itself is done without forking & w/ no thread, but with select()), and these requests are then handled by a dedicated number of threads. There's also a nice explanation of this mechanism at http://lists.initd.org/pipermail/psycopg/2003-March/001906.html but beware! There is a guru wearing a warm cloak of invisibility (+2) roaming around! ;) > Is there someone else using modeling over zope ? cause i read severals > post over last weeks about the lack on this kind of things in zope=20 > (mainly #plone ) and the zope community seems to try different ways > as CMFTypes and Adaptable Storage.=20 I'm using it, but that you already know. And yes, the way the framework can be used along w/ zope is still to be documented. > /Soaf which is going to test modeling over mysql :)=20 Great! I'll wait for your reports then. Cheers, -- S=E9bastien. ------------------------------------------------------------------------ Zope uses threads (possible errors of interpretation of code are all mine): z2.py from ZServer import setNumberOfThreads setNumberOfThreads(NUMBER_OF_THREADS) [...] if HTTP_PORT: [...] hs =3D zhttp_server( [...] ZServer/HTTPServer.py:=20 zhttp_server derives from http_server, and uses zhttp_channel for its channel_class zhttp_channel itself derives from http_channel, and uses ZServer.PubCore.handle in its work() method Last, ZServer.PubCore.__init__ declares handle as ZRendezvous.ZRendevous(_n).handle, where ZRendeVous is declared in ZServer.PubCore.ZRendezvous and creates a pool of threads: (and where _n is assigned by setNumberOfThreads() above in z2.py for option '-t n': "The number of threads to use, if ZODB3 is used.") class ZRendevous: def __init__(self, n=3D1): [...] while n > 0: l=3Dthread.allocate_lock() l.acquire() pool.append(l) thread.start_new_thread(ZServerPublisher,=20 (self.accept,)) ------------------------------------------------------------------------ |