Login bug w/ .10.4 + AccountManagerPlugin - ticket #1493

6 views
Skip to first unread message

Aaron Maxwell - SnapLogic

unread,
May 31, 2007, 9:14:27 PM5/31/07
to Trac Development
Hi,

There is a highest/blocker bug about sessions expiring in .10.4, which
we are attempting to fix. Having dug pretty deep into the internals,
it appears that a specific sql query is misbehaving. I've posted a
writeup here:

http://trac-hacks.org/ticket/1493#comment:7

Please look at it and let me know if you have a suggestion. It seems
like we're pretty close to the solution for this issue; hopefully we
can come up with a patch that fixes it.

Thanks much,
Aaron Maxwell
SnapLogic - Open Source Internet Data Services
http://snaplogic.org/

Christian Boos

unread,
Jun 1, 2007, 4:04:05 AM6/1/07
to trac...@googlegroups.com
Aaron Maxwell - SnapLogic wrote:
> Hi,
>
> There is a highest/blocker bug about sessions expiring in .10.4, which
> we are attempting to fix. Having dug pretty deep into the internals,
> it appears that a specific sql query is misbehaving. I've posted a
> writeup here:
>
> http://trac-hacks.org/ticket/1493#comment:7
>
> Please look at it and let me know if you have a suggestion. It seems
> like we're pretty close to the solution for this issue; hopefully we
> can come up with a patch that fixes it.
>

Here are some ideas to try out...

Looking at the changes from 0.10.3.1 to 0.10.4, I don't see anything
that could have introduced this "interesting" new behavior, except
perhaps at the level of the mysql_backend support itself:

http://trac.edgewall.org/changeset?new=branches%2F0.10-stable%2Ftrac%2Fdb%2Fmysql_backend.py%405024&old=branches%2F0.10-stable%2Ftrac%2Fdb%2Fmysql_backend.py%404342

Try to undo those changes (which, OTOH, were done for a reason, so you
might have other issues), to check if this solves the "auto-logout" issue.

If this is not the case, then please setup a test env using something
else than MySQL (e.g. sqlite), and see if you experience the issue as well.

If the problem is related to MySQL as I'd expect, then perhaps you would
have to debug the mysql bindings themselves, in order to understand why
that SELECT fails when it shouldn't (don't forget to activate the print
statements in trac/db/util.py, to monitor the SQL statements and their
arguments, maybe it's simply the auth_cookie value changing for some
other reason).

-- Christian

Aaron Maxwell - SnapLogic

unread,
Jun 1, 2007, 4:31:14 PM6/1/07
to Trac Development
As a quick trial, I just replaced the mysql_backend.py in .10.4 with
the one from r4342, and the issue went away. So it looks like the
issue is in mysql_backend.py rather than MySQLdb or mysql. That's
good news.

Like you said, all the changes are there for a reason, so the next
step is for me to determine exactly what difference in
mysql_backend.py is connected with the issue. I'll work on that today
and post here when we have a candidate patch.

Christian, thank you.

-Aaron

On Jun 1, 1:04 am, Christian Boos <c...@neuf.fr> wrote:
> Aaron Maxwell - SnapLogic wrote:
>
> > Hi,
>
> > There is a highest/blocker bug about sessions expiring in .10.4, which
> > we are attempting to fix. Having dug pretty deep into the internals,
> > it appears that a specific sql query is misbehaving. I've posted a
> > writeup here:
>
> >http://trac-hacks.org/ticket/1493#comment:7
>
> > Please look at it and let me know if you have a suggestion. It seems
> > like we're pretty close to the solution for this issue; hopefully we
> > can come up with a patch that fixes it.
>
> Here are some ideas to try out...
>
> Looking at the changes from 0.10.3.1 to 0.10.4, I don't see anything
> that could have introduced this "interesting" new behavior, except
> perhaps at the level of the mysql_backend support itself:
>

> http://trac.edgewall.org/changeset?new=branches%2F0.10-stable%2Ftrac%...

Aaron Maxwell - SnapLogic

unread,
Jun 1, 2007, 5:08:09 PM6/1/07
to Trac Development
Update: it looks like this is the relevant diff:

http://trac.edgewall.org/changeset/4962

Still investigating...
-A

On Jun 1, 1:31 pm, Aaron Maxwell - SnapLogic <a...@snaplogic.org>
wrote:

Aaron Maxwell - SnapLogic

unread,
Jun 1, 2007, 8:33:55 PM6/1/07
to Trac Development
OK, here is a patch that seems to correct the issue:
http://trac-hacks.org/attachment/ticket/1493/mysql-autologoutbug.patch

This seems related to the previously closed ticket 4802:
http://trac.edgewall.org/ticket/4802

I believe the reason it does not work on our setup has to do with the
return value of _mysql.ping(). In r5565 (i.e. 0.10.4), in db/
mysql_backend.py we had:

<pre>
def rollback(self):
if self.cnx.ping():
self._set_character_set(self.cnx, 'utf8')
self.cnx.rollback()
else:
self._is_closed = True
</pre>

In our setup, self.cnx.ping() always returns None (as determined
through inserted logging statements). I suppose it returns a
meaningful value in some other setups. However, from the
documentation I found on the net, the return value python's
_mysql.ping() [1] is not explicitly defined, even though the
underlying C api [2] does have a return value. In any case, checking
ping's return value does not seem to work properly in our case, so I
put in a try-except.

Christian, I see you handled the original ticket above. Do you forsee
any problems with the patch? (All the unit tests pass.) In
particular, I'm not sure if ProgrammingError is the best exception to
catch.

Thanks,

Aaron Maxwell
SnapLogic - Open Source Internet Data Services
http://snaplogic.org

[1] http://mysql-python.sourceforge.net/MySQLdb-1.2.2/private/_mysql.connection-class.html#ping

[2] http://dev.mysql.com/doc/refman/5.0/en/mysql-ping.html

Reply all
Reply to author
Forward
0 new messages