You are modifying Auth code. What problem are you trying to solve? Sessions 
and session.auth work well with both stable and trunk version, do they not?

On Wednesday, 16 January 2013 21:19:01 UTC-6, Daniel Gonzalez wrote:
>
> Hi,
>
> I am doing stress testing of my web2py application. The way I am doing 
> this is:
>
>    - 10 parallel clients
>    - the clients log-in automatically, and obtain the session cookie
>    - the clients log-in only *once* at the start of testing.
>    - I use the session cookie to tag log messages in order to look for mý 
>    problem: this way I can relate the log messages to a specific client.
>    - I am looking for problems in the web2py code, specifically in 
>    tools.py, Auth.__init__, where the auth.user is defined
>
> This is my instrumented code (in tools.py, Auth.__init__):
>
>         if auth is None:
>             tools_tracer.show('session.auth is None')
>         if auth and auth.last_visit and auth.last_visit + \
>                 datetime.timedelta(days=0, seconds=auth.expiration) >request
> .now:
>             tools_tracer.show('session.auth active, last_visit=%s', auth.
> last_visit)
>             self.user = auth.user
>             # this is a trick to speed up sessions
>             if (request.now - auth.last_visit).seconds > (auth.expiration 
> / 10):
>                 auth.last_visit = request.now
>         else:
>             self.user = None
>             if session.auth:
>                 del session.auth
>                 tools_tracer.show('session.auth expired')
>
> And (in tools.py, Auth.login_user):
>
>         current.session.auth = Storage(
>             user = user,
>             last_visit=current.request.now,
>             expiration=self.settings.expiration,
>             hmac_key=web2py_uuid())
>         tools_tracer.show('session.auth created')
>
> This is my current log:
>
> 2013-01-17 04:00:41,816 - Thread-5                  - c2d769 session.auth 
> is None
> 2013-01-17 04:00:41,861 - Thread-5                  - c2d769 session.auth 
> created
> 2013-01-17 04:00:41,984 - Thread-6                  - c2d769 session.auth 
> active, last_visit=2013-01-17 04:00:41.791030
> 2013-01-17 04:00:48,923 - Thread-7                  - c2d769 session.auth 
> is None
> 2013-01-17 04:01:51,131 - Thread-10                 - c2d769 session.auth 
> is None
> 2013-01-17 04:01:51,214 - Thread-9                  - c2d769 session.auth 
> is None
> 2013-01-17 04:02:42,506 - Thread-6                  - c2d769 session.auth 
> is None
> 2013-01-17 04:04:42,791 - Thread-9                  - c2d769 session.auth 
> active, last_visit=2013-01-17 04:04:07.717197
> 2013-01-17 04:04:42,816 - Thread-4                  - c2d769 session.auth 
> is None
> 2013-01-17 04:04:48,862 - Thread-10                 - c2d769 session.auth 
> is None
> 2013-01-17 04:04:49,251 - Thread-6                  - c2d769 session.auth 
> is None
> 2013-01-17 04:05:35,713 - Thread-7                  - c2d769 session.auth 
> is None
> 2013-01-17 04:06:39,764 - Thread-8                  - c2d769 session.auth 
> active, last_visit=2013-01-17 04:06:10.853567
> 2013-01-17 04:06:39,803 - Thread-2                  - c2d769 session.auth 
> is None
> 2013-01-17 04:07:35,154 - Thread-8                  - c2d769 session.auth 
> active, last_visit=2013-01-17 04:07:00.261709
> 2013-01-17 04:07:40,860 - Thread-9                  - c2d769 session.auth 
> is None
> 2013-01-17 04:07:46,176 - Thread-8                  - c2d769 session.auth 
> is None
> 2013-01-17 04:07:46,266 - Thread-5                  - c2d769 session.auth 
> is None
> 2013-01-17 04:08:27,416 - Thread-9                  - c2d769 session.auth 
> active, last_visit=2013-01-17 04:08:03.492030
> 2013-01-17 04:08:27,436 - Thread-2                  - c2d769 session.auth 
> is None
> 2013-01-17 04:09:31,485 - Thread-10                 - c2d769 session.auth 
> is None
> 2013-01-17 04:11:21,903 - Thread-7                  - c2d769 session.auth 
> is None
> 2013-01-17 04:12:20,207 - Thread-10                 - c2d769 session.auth 
> is None
>
> (the c2d769 is a hash of the cookie, and identifies the client)
>
> As you can see, very often (for this specific client, other clients have 
> fewer problems), the session.auth  is not there. But then suddenly, in the 
> following request, it is there again.
>
> What can be causing this strange problem?
>
> Thanks,
> Daniel
>
>

-- 



Reply via email to