[mod_python] Session-related hang

Boris Dušek boris.dusek at gmail.com
Tue Aug 28 22:26:18 EDT 2007


Hi,

I am using Apache 2.2.3, mod_python 2.3.8. I experience a hang that is
related to Session.
I have such a class:

file nanosession.py:
class NanoSession(Session.DbmSession):
    def __init__(self, req):
        logging.debug("In NanoSession.__init__")
        logging.debug("Calling DbmSession.__init__")
        Session.DbmSession.__init__(self, req)

    def ...

in the index.py file, that gets displayed by mod_python.publisher,
there is following code:

def index(req, **vars):
    logging.debug("Entered index.py/index")

    logging.debug("Reloading module 1")
    reload(module1)

    logging.debug("Reloading module nanosession")
    reload(nanosession)

    logging.debug("Reloading module 2")
    reload(module2)

    logging.debug("Generating page content")
    content = generate_content(...)


When I hit for the index.py page, it was working for the first time. I
am not really sure what I have been doing then, probably just surfing
the other pages on the same site. And then suddenly, from then on,
when I wanted to display some page, it took forever (I mean not long,
I mean it did not display, Firefox displaying "Waiting for ...",
netcat displaying no output available). Then I asked a friend at a
different computer (with a different IP) to try to access the same
webpage - he could access it, and it displayed immediately. However,
then he hit the reload button in his browser, and he was immediately
from then on experiencing the same "never loads" behavior for any
webpage that uses sessions.

The logging output from the above code shows that it hangs on
DbmSession.__init__:

DEBUG:root:Entered index.py/index
DEBUG:root:Reloading module webpage
DEBUG:root:Reloading module webpage
DEBUG:root:Reloading module webpage
DEBUG:root:Creating session
DEBUG:root:nanosession.py/NanoSession.__init__
DEBUG:root:calling DbnSession.__init__
DEBUG:root:Entered index.py/index
DEBUG:root:Reloading module webpage
DEBUG:root:Reloading module webpage
DEBUG:root:Reloading module webpage
DEBUG:root:Creating session
DEBUG:root:nanosession.py/NanoSession.__init__
DEBUG:root:calling DbmSession.__init__
...
and so on...

Do you please have any suggestions about possible cause and workarounds?

Thanks,
Boris Dušek



More information about the Mod_python mailing list