Coder Social home page Coder Social logo

Comments (4)

hishamco avatar hishamco commented on May 24, 2024

/cc @Tratcher @kichalla

from session.

davidfowl avatar davidfowl commented on May 24, 2024

/cc @lodejard

from session.

Tratcher avatar Tratcher commented on May 24, 2024

All of your observations are correct, and this is the intentional design. In previous versions of ASP.NET locking the session caused crippling problems with parallel request processing, especially across multiple servers. The new design acknowledges the lossy nature of sessions and does not attempt any concurrency guarantees (except non-corruption).

Serializing all of the values together as a coherent session helps avoid inconsistencies between related keys. We may eventually provide an alternate implementation for incoherent sessions (e.g. each key cached separately). This could also be provided by the community.

Note session will always have an initial race condition if multiple requests are made before the session cookie is set on the client. Each of those parallel requests may create its own session and cookie and then the browser will only keep the last one.

from session.

wanton7 avatar wanton7 commented on May 24, 2024

It's true that there could be a race condition when session is first created, but usually it's a page load that creates session and not an ajax call so it's highly unlikely.

Locked update scope would allow to keep multiple related keys consistent and also allow you to even increase a session based counter correctly if session state was refreshed after lock was taken.

In our company's software we do lot of session updates via ajax. When we move to new Asp.Net we probably have to write our own session store to avoid this situation.
It's really great that with this new middleware system we can do that easily.

from session.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.