Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>BuzzAnn,</p> <p>Microsoft's documentation on the topic indicates that setting your page-level session state mode to "ReadOnly" should safeguard you against concurrent attempts to <em>write</em> session state information (they'll queue and be handled serially), but multiple readers will be allowed. See the "Synchronizing Access to the Session State" section:</p> <p><a href="http://msdn.microsoft.com/en-us/library/aa479041.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa479041.aspx</a></p> <p>When the <strong>EnableSessionState</strong> property for a page is set to "ReadOnly," each page request attempts to get a reader lock on the state information. In standard ReaderWriterLock semantics, any number of readers can have concurrent access to the information being protected. Any request that achieves a writer lock (e.g., through <strong>EnableSessionState</strong> being set to "true"), though, will block writes <em>and</em> reads on the session state information until the request holding the writer lock completes.</p> <p>As long as all you're trying to do is read session state information from your pages while they have <strong>EnableSessionState</strong> set to "ReadOnly," all read requests will proceed without blocking. If you attempt to write, though, the documentation isn't clear about what will actually happen. Assuming a ReaderWriterLock is all that's being used to synchronize access, my guess is that you won't be protected against overwrites, race conditions, and other non-synchronized access problems.</p> <p>If you're going to attempt to write to session state, be sure to set <strong>EnableSessionState</strong> to "true" to ensure that a writer lock is achieved and synchronization occurs as is needed.</p> <p>I hope this helps!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. COIt really is not clear what happens though for inproc only. Does it still actually use reader\writer locking for inproc since it doesn't follow the readonly setting with inproc. The only bit of info I have found is from http://www.syncfusion.com/faq/aspnet/web_c9c.aspx which states: "Even those enableSessionState is marked as ReadOnly, but in InProc state, the user can still modify the session. The only difference is that the session will not be locked during the request. This limitation is by-design"
      singulars
    2. COThe text block you cited from SyncFusion is consistent with what I would expect based on ReaderWriterLock semantics. Setting the EnableSessionState mode to "ReadOnly" doesn't *make it* read only for InProc; rather, you're indicating (to ASP.NET) that you *intend* to use it in a read-only fashion. The "ReadOnly" mode is less restrictive than the "true" mode and only guarantees that you won't collide with other changes being made by pages that have an EnableSessionState of "true." Trying to modify session state from a page in "ReadOnly" mode remains a hazardous proposition. Does that help?
      singulars
    3. COYes, that helps. So what you are saying is that locking still occurs even with InProc. Whether it be readonly with reader locks or "true" with writer locks. I agree it is hazardous to try and make all pages readonly in inproc mode while still writing to the session on those pages. However it was suggested as an option by a coworker and I am trying to determine if doing that solves the lock contention problem without having to change all the code to not write to sessions. We have a tiny percentage of requests that get blocked for 2 minutes while waiting on a request that never finished.Thx
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload