#8616: File-based sessions dropped with SESSION_SAVE_EVERY_REQUEST = True
----------------------------------------------+-----------------------------
Reporter: [EMAIL PROTECTED] | Owner: jacob
Status: assigned | 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]):
Replying to [comment:18 mtredinnick]:
> Leaving 0 bytes files around is simply not an option. It will eventually
fill up the directory's dirent records to the point that you cannot create
any more files, which is very uncool. We can't replace one bug with a
different one.
>
I agree that we cannot replace one bug with a different one and I
definitely understand your concern about leaving the lock files around
indefinitely.
However, with my patch, the django-controlled lifetime of the lock files
was the same as the session file itself. I unlinked them in the delete()
method. So, the number of files would grow twice as fast as before, but
the growth would be linear. The only caveat I can think of is the one I
mentioned earlier: external session sweeper code that ignores the lock
file. I tried to mitigate this by purposely keeping the lock file name
very similar to the lock itself.
I'm doing some more thinking about why the unlinking is causing problems.
I suspect a race condition, but I'm not versed enough in the low-level I/O
stuff to know for sure.
I agree that my patch was not perfect. Your judicious addition of
try:finally blocks was definitely needed. Were we to proceed with the
long-lived lock file solution, the delete() method would need to insure
that an exception generated by unlinking the session file did not cause
the unlinking of the lock file to never be attempted.
In the end, though, if we can make the rename solution workable, that
would be preferable.
--
Ticket URL: <http://code.djangoproject.com/ticket/8616#comment:22>
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
-~----------~----~----~----~------~----~------~--~---