Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1325 (closed defect: fixed)

Opened 10 years ago

Last modified 10 years ago

[PATCH] savisit creates extra orphan visits

Reported by: corvus Owned by: faide
Priority: normal Milestone: 1.0.3
Component: Identity Version: 1.0.1
Severity: normal Keywords:
Cc:

Description

SqlAlchemyVisitManager? is missing a session.flush() call after it creates a new visit. This means that subsequent code that looks for a visit_key (ie to associate an identity with a visit after credential verification) won't find a visit that was just added in the same request. But the extra visit does eventually get added in the flush at the end of the request, but by then the identity has been associated with a new visit, so it's just orphaned in the db.

The solution is to add session.flush() after the save(...) call in new_visit_with_key.

This however, causes extra sessions to be created in a new manner. During an inital visit (without a cookie), the visit code will create a new session. Subsequently the identity framework may cause the visit filter to run again. It will try to look up the session again, still without a cookie from the client and again fail and therefore create a second session. Both of these will get committed to the database because of the above fix. My proposed solution to that is to make the visit filter aware of whether there is a current visit (which there will be if the filter has already run). If there is such a current visit, it will not execute the lookup or initialization code.

I will attach two patches, one for each of the above problems.

Attachments

savisit.patch Download (489 bytes) - added by corvus 10 years ago.
Patch to savasit.py
api.patch Download (1.3 KB) - added by corvus 10 years ago.
visit api.py patch

Change History

Changed 10 years ago by corvus

Patch to savasit.py

Changed 10 years ago by corvus

visit api.py patch

comment:1 Changed 10 years ago by corvus

  • Owner set to anonymous
  • Component changed from unassigned to Identity

comment:2 Changed 10 years ago by alberto

Anyone using SA visits can test this patch?

Thanks,

Alberto

comment:3 Changed 10 years ago by alberto

  • Milestone changed from 1.0.2 to 1.0.3

comment:4 Changed 10 years ago by faide

  • Summary changed from savisit creates extra orphan visits to [PATCH] savisit creates extra orphan visits

comment:5 Changed 10 years ago by faide

  • Owner changed from anonymous to faide
  • Status changed from new to assigned

comment:6 Changed 10 years ago by faide

  • Status changed from assigned to closed
  • Resolution set to fixed

Commited at r3250 (1.0.3dev) and r3251 (1.1dev) Thanks a lot. :)

Note: See TracTickets for help on using tickets.