[mod_python] Threads in mod_python - Publisher Handler (Just starting)

Brett Haydon bbhaydon at bigpond.com
Sun Dec 31 17:19:30 EST 2000


I'm just trying to come to grips with the
excellent Publisher Handler (on Win32).

I thought function calls are executed sequentially,
(ie browser1 executes func1 then browser2 exec func1)
but testing some code, (trimmed slightly):

cache{}
def func(req):

    while 1:
        cache[users.cookie] = [random.random()]

    return never

it appears that calling func() in multiple browsers
will start a thread in each of them that goes on until the
server is stopped.

I am trying to work out the implications for calls that
bump into each other (especially database calls) that share
objects. A quick test by starting some threads in a script
that call the same URLs (which have database functions)
appears to confirm this, in that in six threads up to three of them
apparantly produce a blank page.

Has anyone come up with strategies to deal with this.

regards,

Brett




More information about the Mod_python mailing list