Skip to content

v1.0.4: Skip Release for sessions that were not mutated

Latest

Choose a tag to compare

@unknwon unknwon released this 22 May 03:34
ae808a4
The file provider (and others that persist via Encode in Release) writes the
session unconditionally at the end of every request. Two concurrent reads of
the same session ID then race: each request encodes its stale snapshot and
writes it back, so an in-flight mutation from a third request can be clobbered.

Track Set/Delete/Flush calls on a wrapper around the per-request RawStore and
skip Release when nothing was written. Reads no longer touch the backing
store, eliminating the race for read-only traffic.