Re: [Webware-discuss] How to prevent a session creation?

Top Page
Author: Ben Parker
Date:  
To: Discussion of Webware for Python including feedback and proposals.
Subject: Re: [Webware-discuss] How to prevent a session creation?

Christoph Zwerschke wrote on 8/30/07 1:45 AM:
> sophana wrote:
>
>> The monitoring servlet is a subclass of WebKit.Page
>> All it does it make an sql ping, and write 'success' to the output.
>> It does not use any session.
>> But my simple test is as follow.
>> - I shut down the appserver.
>> - erase all session files
>> - restart AppServer
>> - make a wget loop on the monitoring servlet.
>> - shutdown again
>> - then I see a LOT session created. note that the test is made on 0.9.2
>> webware...
>> They are not created if I use the cookie session option of wget.
>>
>
> Is this still an open issue? If yes, can you check with 0.9.4 or send me
> your monitoring servlet and the wget commands/script you are using? I'll
> try to reproduce it here.
>
>
>

If nobody else has figured this one out, I just did. We use a database
backed session store and I came across this after noticing extra db hits
for pages which did not use the session.

The problem is that HTTPResponse.recordSession() is referencing
transaction.session() instead of transaction._session when checking for
the existence of (and therefore need to save/send cookie for) the
Session. The session() method creates the session if it did not exist,
which defeats the purposes of what recordSession() is trying to do, and
ends up creating a Session object for every request.

The bugfix patch against Webware 0.9.4 or 0.9.3 is very simple. I'll
submit this to sourceforge shortly:

$ diff HTTPResponse.original.py HTTPResponse.py
348c348
< sess = trans.session()
---
 >               sess = trans._session

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Webware-discuss mailing list
Webware-discuss@???
https://lists.sourceforge.net/lists/listinfo/webware-discuss