[Mono-bugs] [Bug 668696] New: [Regression] SynchronizationLockException when accessing HttpApplicationState after Lock() is called
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue Feb 1 13:53:56 EST 2011
https://bugzilla.novell.com/show_bug.cgi?id=668696
https://bugzilla.novell.com/show_bug.cgi?id=668696#c0
Summary: [Regression] SynchronizationLockException when
accessing HttpApplicationState after Lock() is called
Classification: Mono
Product: Mono: Class Libraries
Version: SVN
Platform: Macintosh
OS/Version: Mac OS X 10.6
Status: NEW
Severity: Major
Priority: P5 - None
Component: Sys.Web
AssignedTo: mhabersack at novell.com
ReportedBy: curtis.wensley at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
Created an attachment (id=411590)
--> (http://bugzilla.novell.com/attachment.cgi?id=411590)
Sample to reproduce the error
Description of Problem:
When using Lock()/Unlock() to access/add elements to the HttpApplicationState
(HttpContext.Current.Application) to deal with threading issues, a
System.Threading.SynchronizationLockException is thrown.
The pattern used to add to the application state in an IHttpModule is:
const string MyKey = "mykey";
var app = HttpContext.Current.Application;
if (app[MyKey] == null)
{
app.Lock();
if (app[MyKey] == null) // exception here
{
app[MyKey] = "some object";
}
app.UnLock();
}
Steps to reproduce the problem:
1. Compile & run attached application
Actual Results:
a SynchronizationLockException is thrown
Expected Results:
Should not throw an exception
How often does this happen?
Every time
Additional Information:
Stack Trace:
System.Threading.SynchronizationLockException: The current thread has not
entered the lock in read mode
at System.Threading.ReaderWriterLockSlim.ExitReadLock () [0x00022] in
/private/tmp/monobuild/build/BUILD/mono-2.10/mcs/class/System.Core/System.Threading/ReaderWriterLockSlim.cs:211
at System.Web.HttpApplicationState.Get (System.String name) [0x0001a] in
/private/tmp/monobuild/build/BUILD/mono-2.10/mcs/class/System.Web/System.Web/HttpApplicationState.cs:84
at System.Web.HttpApplicationState.get_Item (System.String name) [0x00000] in
/private/tmp/monobuild/build/BUILD/mono-2.10/mcs/class/System.Web/System.Web/HttpApplicationState.cs:182
at TestCustomAppModule.MyModule.HandleContextBeginRequest (System.Object
sender, System.EventArgs e) [0x0000b] in
/Users/cwensley/Projects/test/TestCustomAppModule/TestCustomAppModule/MyModule.cs:22
at System.Web.HttpApplication+<RunHooks>c__Iterator5.MoveNext () [0x001aa] in
/private/tmp/monobuild/build/BUILD/mono-2.10/mcs/class/System.Web/System.Web/HttpApplication.cs:1038
at System.Web.HttpApplication+<Pipeline>c__Iterator6.MoveNext () [0x00137] in
/private/tmp/monobuild/build/BUILD/mono-2.10/mcs/class/System.Web/System.Web/HttpApplication.cs:1198
at System.Web.HttpApplication.Tick () [0x00000] in
/private/tmp/monobuild/build/BUILD/mono-2.10/mcs/class/System.Web/System.Web/HttpApplication.cs:926
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list