#8616: File-based sessions dropped with SESSION_SAVE_EVERY_REQUEST = True
----------------------------------------------+-----------------------------
          Reporter:  [EMAIL PROTECTED]    |         Owner:  mtredinnick        
            Status:  reopened                 |     Milestone:  1.0             
   
         Component:  django.contrib.sessions  |       Version:  SVN             
   
        Resolution:                           |      Keywords:  session, file, 
race
             Stage:  Accepted                 |     Has_patch:  1               
   
        Needs_docs:  0                        |   Needs_tests:  0               
   
Needs_better_patch:  0                        |  
----------------------------------------------+-----------------------------
Changes (by anonymous):

  * status:  closed => reopened
  * resolution:  fixed =>

Comment:

 I thought a lot about this last night and came to the same conclusion.

 I just updated to the latest trunk and my test app doesn't work at all
 now.  It seems to not be saving the session data at all.

 I have isolated the breakage to rev 8688, which is where you fixed this
 ticket.

 I have further isolated the problem to the unlinking of the lock files.
 The load() method expects the lock file to exist when it opens it (mode =
 "rb").  I changed the mode to "wb", just like the save() method, but no
 joy.

 As I think more about this, unlinking the lock file creates yet another
 race condition.  The whole point of the lock file is that it is a shared
 locking context.  Having each request unlink it destroys the shared
 context and may create the situation where there are several lock file
 handles in existence at once with only one of them being linked to the
 lock file name on the file system.  How this is causing my session data to
 be lost is beyond me.

 I understand the issue with increased inode usage with the 0-byte lock
 files hanging around, but I don't see any easy way around it.  I sure wish
 the O_SHLOCK and O_EXLOCK flags existed on all platforms.  That is the
 elegant solution.

 Since the problem we are trying to solve only manifests itself under
 certain circumstances, maybe we should make the locking optional.
 However, I'm inclined to err on the side of caution and guarantee session
 file integrity under *any* conditions.

 Your call.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/8616#comment:14>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to