[mod_python] Session-related hang

Boris Dušek boris.dusek at gmail.com
Wed Aug 29 23:10:27 EDT 2007


Hi Graham,

On 8/28/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote:
> You are likely trying to create a session object when one has already
> been created for that request already and thus dead locking on
> yourself. There are lots of examples of people doing this in the
> www.modpython.org mailing list archives, search from www.modpython.org
> search box.
>
> What is in generate_content(...)? Without seeing how you are
> manipulating sessions can say exactly what you are doing wrong

The problem is fixed now. It was permission issue on the dbm file
where DbmSession stores the session information (/tmp/mp_sess.dbm by
default).

> BTW, why are you creating a derived session object type?

Because we need some convenience methods for the session class, like
for user management etc.

> Also, using reload() like that is not recommended. Upgrade to
> mod_python 3.3.1 and read about import_module() function in:
>
>   http://www.modpython.org/live/current/doc-html/pyapi-apmeth.html

We would love to upgrade. It would be easy on our development virtual
machines. But not at all easy to push for this upgrade on a production
server where many sites are using it.

> Graham

Thank you for your answer,
Boris

>
> On 29/08/2007, Boris Dušek <boris.dusek at gmail.com> wrote:
> > 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
> >
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
> >
>



More information about the Mod_python mailing list