-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File session can die if file removed #45
Comments
In retrospect, even if you're running two servers on the same box, and using the file backing, the two can get out of sync if they both cache the same session from the file system...so much difficulty makes me think to propose that it never cache but just always re-read from the file system. It also seems that destroy_all doesn't work because of the cache (leaves cached one undestroyed). Though unrelated...FWIW... |
In addition, it's not hard to imagine a race condition scenario today, when servicing multi simultaneous requests, these lines:
could be run interleaved by different fibers, and return the value from a different session [?] |
File storage also has an issue when utime fails. I have this working on a development server inside a vm. The storage folder is on the host, and doesn't seem to support changing the time. So it throws an exception every time is_in_cache is called which I think is once a minute. On the live server, without the vm / host drive, it works fine. As for the issues above, a note to say file sessions are not suitable for apps with multiple instances would probably be enough. If you're app needs multiple instances, it probably also needs redis based sessions? |
I agree with @crisward that something like |
Yeah or mysql is a typical one. I think the original problem is still
present even if run on only one instance however...
…On Thu, May 4, 2017 at 5:57 AM, Serdar Dogruyol ***@***.***> wrote:
I agree with @crisward <https://github.com/crisward> that something like
redis or memcached will be more suitable for apps with multiple instances
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#45 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAw0OjT8A8OYTsAo1IWKWJk_FRB5LhTks5r2b0_gaJpZM4M9Suc>
.
|
set the
then access your web server so the cookie file is created.
Now wait one minute so the File.utime stuff will be triggered (or possibly until a gc fires that cleans it up?)
Delete the file.
Access your web server.
though it does recover a bit after that.
I'm also not sure how I feel about the file stuff being cached at all, since the cache will persist across requests which means if it's in front of a load balancer, with a shared file system, it wouldn't persist across servers. Maybe this should be noted somewhere? Or I think ideally it would at least re-read "in" the file at the beginning of each request...or at least compare mtime with the last known mtime. Or else be made clear that it doesn't work today with shared storage (or perhaps I'm wrong?)
Cheers!
The text was updated successfully, but these errors were encountered: