Comments (7)
https://gist.github.com/dakkar/5645bb54bdfa1ede08fa a small test case.
The problem does not seem to happen much with the File
store, but it happen pretty reliably with the DBI
store.
from plack-middleware-session.
Excellent catch. cc @alexmv
We'd either have an option to disable the behavior, or have some kind of API using special keys in $env
to change the behavior in runtime - which would probably default to the before phase like we do, since updating session in the stream response sounds rarer for me.
Doing the save twice might be doable but I personally don't like it.
from plack-middleware-session.
psgix.session.options
already has similar no_store
which prevents updating the data for the session that doesn't need save. Can we add a new option like late_store
which enables the introduced behavior, and otherwise updating before the streaming response like previously? @alexmv
from plack-middleware-session.
Hm. I entirely believe the race condition -- though I'm unable to duplicate it using the gist you showed. Is the got/expected
failure supposed to occur without the ForceSessionSave middlware? Even with 10 parallel user agents and upping it to 5 redirects instead of three, I'm unable to get a mismatch.
I'll push a branch shortly which makes the late storage behavior contingent on a psgix.sesison.options
flag.
from plack-middleware-session.
@dakkar, can you confirm the above branch fixes this for you?
from plack-middleware-session.
I just shipped 0.27-TRIAL with the fix.
from plack-middleware-session.
@alexmv confirmed, it works. thank you!
from plack-middleware-session.
Related Issues (20)
- <miyagawa> we need Store::Cookie for Session HOT 1
- Undeclared dependency Digest::HMAC_SHA1
- test requires LWP::UserAgent and HTTP::Cookies
- Add hooks to indicate whether a session should be given/updated HOT 2
- calculate cookie expires using lifetime HOT 1
- Storable deserealization fail should cause 500 HOT 2
- Strange failure in t/004a_basic_file_w_customs.t and t/004_basic_file_w_customs.t ( parallelism fail ? ) HOT 2
- Build.PL failure HOT 1
- SEE ALSO link broken in Plack::Middleware::Session::Cookie HOT 1
- move the repository to plack organization HOT 5
- inconsistent version HOT 1
- Recreating cookies with per-request values isn't documented HOT 2
- Session object is not created when using with CGI::Application HOT 1
- Please switch from Digest::SHA1 to Digest::SHA HOT 2
- Plack-Middleware-Session: tests fail on Perl 5 blead: no dot in default @INC HOT 4
- Support for "samesite" attribute of cookies
- Random t/012_streaming.t failures
- t/015_cookie_options_mw.t fails (with old Cookie::Baker?)
- updated Plack/Middleware/Session/Cookie.pm attribute list to make SameSite=Lax appear
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plack-middleware-session.