durusmail: quixote-users: Non-reproducible problem: get_request() returns None
Non-reproducible problem: get_request() returns None
Non-reproducible problem: get_request() returns None
2005-01-24
Non-reproducible problem: get_request() returns None
2005-01-24
2005-01-24
Non-reproducible problem: get_request() returns None
Titus Brown
2005-01-24
-> Sometimes, in a regular program run, get_request() returns None. Repeating
-> the same request issuing a page refresh usually works fine. It looks to me
-> it happens most often while rendering pages that are redirect() target,
-> but the last traceback i received from a testing environment looks like an
-> ordinary get.
->
-> The traceback ends with:
-> ....
->   File
-> "C:/Programmi/PiroSoftware/renapp\renapp\web\styles\renault\WebPage.ptl",
-> line 28, in render_header
->     user = get_user()
->   File "c:\programmi\python23\Lib\site-packages\quixote\publish.py", line
-> 885, in get_user
->     session = _publisher.get_request().session
-> AttributeError: 'NoneType' object has no attribute 'session'

Hi, Daniele,

this looks familiar to me!  What session handling mechanism are you
using, and are you sure that sessions are being committed to a
centrally accessible table?

If I remember correctly, this error can be thrown by session handling
code that is assigning a new session in the middle of the site, where
your code expects a user to already be assigned.  The new session
doesn't have a user attached to it yet, so your code breaks.

The sporadic nature of the error is almost certainly caused by the
session table not being replicated/accessible across the different
Apache processes.  Most of the time (on low load sites or while testing)
process 0 will be handling requests; then, occasionally, after a quick
redirect or multiple hits, process 1 will get a request & bomb because
it doesn't have the right sessions in its session table.

I hope this helps.

cheers,
--titus

reply