#8616: File-based sessions dropped with SESSION_SAVE_EVERY_REQUEST = True
----------------------------------------------+-----------------------------
Reporter: [EMAIL PROTECTED] | Owner: nobody
Status: new | 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 |
----------------------------------------------+-----------------------------
Comment (by [EMAIL PROTECTED]):
I tried using django.core.files.locks again and got similar results as
before. As I think about it, perhaps this is what is happening:
1. Request A opens the file for writing, truncating the file.
1. Request B opens the file for reading.
1. Request B obtains a shared lock on the file.
1. Request B reads the empty file.
1. Request B closes the file, releasing the shared lock.
1. Request A obtains an exclusive lock on the file, writes the session
data, and closes the file, releasing the exclusive lock.
1. Request B is left with no data from the empty file it read.
Apparently, using the O_SHLOCK and O_EXLOCK flags prevents the file from
being truncated until the exclusive lock has been obtained. Can this
behavior be duplicated somehow?
--
Ticket URL: <http://code.djangoproject.com/ticket/8616#comment:6>
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
-~----------~----~----~----~------~----~------~--~---