Author: mhabersack
Date: 2007-08-08 05:36:02 -0400 (Wed, 08 Aug 2007)
New Revision: 83648
Modified:
trunk/mcs/class/System.Web/System.Web.Configuration/ChangeLog
trunk/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs
trunk/mcs/class/System.Web/System.Web.SessionState/ChangeLog
trunk/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs
trunk/mcs/class/System.Web/System.Web/CapabilitiesLoader.cs
trunk/mcs/class/System.Web/System.Web/ChangeLog
trunk/mcs/class/System.Web/System.Web/HttpApplication.cs
trunk/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
trunk/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs
trunk/mcs/class/System.Web/System.Web/SiteMapProvider.cs
trunk/mcs/class/System.Web/System.Web/StaticSiteMapProvider.cs
trunk/mcs/class/System.Web/System.Web/TimeoutManager.cs
trunk/mcs/class/System.Web/System.Web/XmlSiteMapProvider.cs
Log:
2007-08-08 Marek Habersack <[EMAIL PROTECTED]>
* SessionDictionary.cs: do not use lock (this), replace it
with lock (this_object), where this_object is an instance
variable. Prevents deadlocks in situation when external code locks
on the class instance.
2007-08-08 Marek Habersack <[EMAIL PROTECTED]>
* WebConfigurationSettings.cs: do not use lock (this), replace it
with lock (this_object), where this_object is an instance
variable. Prevents deadlocks in situation when external code locks
on the class instance.
2007-08-08 Marek Habersack <[EMAIL PROTECTED]>
* StaticSiteMapProvider.cs, HttpApplicationFactory.cs,
HttpStaticObjectsCollection.cs, SiteMapProvider.cs,
XmlSiteMapProvider.cs, HttpApplication.cs, CapabilitiesLoader.cs,
TimeoutManager.cs: do not use lock (this), replace it with lock
(this_object), where this_object is an instance variable. Prevents
deadlocks in situation when external code locks on the class
instance.
Modified: trunk/mcs/class/System.Web/System.Web/CapabilitiesLoader.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/CapabilitiesLoader.cs 2007-08-08
09:12:49 UTC (rev 83647)
+++ trunk/mcs/class/System.Web/System.Web/CapabilitiesLoader.cs 2007-08-08
09:36:02 UTC (rev 83648)
@@ -45,6 +45,8 @@
class BrowserData
{
static char [] wildchars = new char [] {'*', '?'};
+
+ object this_lock = new object ();
BrowserData parent;
string text;
string pattern;
@@ -148,7 +150,7 @@
if (pattern == null)
return expression.Length == 0;
- lock (this) {
+ lock (this_lock) {
if (regex == null)
#if TARGET_JVM
regex = java.util.regex.Pattern.compile
(pattern);
Modified: trunk/mcs/class/System.Web/System.Web/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web/ChangeLog 2007-08-08 09:12:49 UTC
(rev 83647)
+++ trunk/mcs/class/System.Web/System.Web/ChangeLog 2007-08-08 09:36:02 UTC
(rev 83648)
@@ -1,3 +1,13 @@
+2007-08-08 Marek Habersack <[EMAIL PROTECTED]>
+
+ * StaticSiteMapProvider.cs, HttpApplicationFactory.cs,
+ HttpStaticObjectsCollection.cs, SiteMapProvider.cs,
+ XmlSiteMapProvider.cs, HttpApplication.cs, CapabilitiesLoader.cs,
+ TimeoutManager.cs: do not use lock (this), replace it with lock
+ (this_object), where this_object is an instance variable. Prevents
+ deadlocks in situation when external code locks on the class
+ instance.
+
2007-08-05 Vladimir Krasnov <[EMAIL PROTECTED]>
* HttpUtility.cs: performance refactoring, optimized UrlEncode
Modified: trunk/mcs/class/System.Web/System.Web/HttpApplication.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/HttpApplication.cs 2007-08-08
09:12:49 UTC (rev 83647)
+++ trunk/mcs/class/System.Web/System.Web/HttpApplication.cs 2007-08-08
09:36:02 UTC (rev 83648)
@@ -87,6 +87,8 @@
// attributes
[ToolboxItem(false)]
public class HttpApplication : IHttpAsyncHandler, IHttpHandler,
IComponent, IDisposable {
+ object this_lock = new object();
+
HttpContext context;
HttpSessionState session;
ISite isite;
@@ -164,7 +166,7 @@
internal void InitOnce (bool full_init)
{
- lock (this) {
+ lock (this_lock) {
if (modcoll != null)
return;
Modified: trunk/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
2007-08-08 09:12:49 UTC (rev 83647)
+++ trunk/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
2007-08-08 09:36:02 UTC (rev 83648)
@@ -45,6 +45,8 @@
namespace System.Web {
class HttpApplicationFactory {
+ object this_lock = new object ();
+
// Initialized in InitType
#if TARGET_J2EE
static HttpApplicationFactory theFactory {
@@ -127,7 +129,7 @@
Hashtable GetApplicationTypeEvents (Type type)
{
- lock (this) {
+ lock (this_lock) {
if (app_event_handlers != null)
return app_event_handlers;
@@ -147,7 +149,7 @@
Hashtable GetApplicationTypeEvents (HttpApplication app)
{
- lock (this) {
+ lock (this_lock) {
if (app_event_handlers != null)
return app_event_handlers;
@@ -353,7 +355,7 @@
void InitType (HttpContext context)
{
- lock (this) {
+ lock (this_lock) {
if (!needs_init)
return;
Modified: trunk/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs
2007-08-08 09:12:49 UTC (rev 83647)
+++ trunk/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs
2007-08-08 09:36:02 UTC (rev 83648)
@@ -33,9 +33,11 @@
private Hashtable _Objects;
class StaticItem {
+ object this_lock = new object();
+
Type type;
object instance;
-
+
public StaticItem (Type type)
{
this.type = type;
@@ -48,7 +50,7 @@
public object Instance {
get {
- lock (this) {
+ lock (this_lock) {
if (instance == null)
instance =
Activator.CreateInstance (type);
}
Modified: trunk/mcs/class/System.Web/System.Web/SiteMapProvider.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/SiteMapProvider.cs 2007-08-08
09:12:49 UTC (rev 83647)
+++ trunk/mcs/class/System.Web/System.Web/SiteMapProvider.cs 2007-08-08
09:36:02 UTC (rev 83648)
@@ -41,6 +41,7 @@
namespace System.Web {
public abstract class SiteMapProvider : ProviderBase {
+ internal object this_lock = new object ();
bool enableLocalization;
SiteMapProvider parentProvider;
@@ -229,7 +230,7 @@
public virtual SiteMapProvider RootProvider {
get {
- lock (this) {
+ lock (this_lock) {
if (rootProviderCache == null) {
SiteMapProvider current = this;
while (current.ParentProvider
!= null)
Modified: trunk/mcs/class/System.Web/System.Web/StaticSiteMapProvider.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/StaticSiteMapProvider.cs
2007-08-08 09:12:49 UTC (rev 83647)
+++ trunk/mcs/class/System.Web/System.Web/StaticSiteMapProvider.cs
2007-08-08 09:36:02 UTC (rev 83648)
@@ -51,7 +51,7 @@
if (node == null)
throw new ArgumentNullException ("node");
- lock (this) {
+ lock (this_lock) {
string url = node.Url;
if (url != null && url.Length > 0) {
url = MapUrl (url);
@@ -82,7 +82,7 @@
Hashtable NodeToParent {
get {
- lock (this) {
+ lock (this_lock) {
if (nodeToParent == null)
nodeToParent = new Hashtable ();
}
@@ -92,7 +92,7 @@
Hashtable NodeToChildren {
get {
- lock (this) {
+ lock (this_lock) {
if (nodeToChildren == null)
nodeToChildren = new Hashtable
();
}
@@ -102,7 +102,7 @@
Hashtable UrlToNode {
get {
- lock (this) {
+ lock (this_lock) {
if (urlToNode == null) {
urlToNode = new Hashtable
(StringComparer.InvariantCultureIgnoreCase);
}
@@ -113,7 +113,7 @@
Hashtable KeyToNode {
get {
- lock (this) {
+ lock (this_lock) {
if (keyToNode == null)
keyToNode = new Hashtable ();
}
@@ -123,7 +123,7 @@
protected virtual void Clear ()
{
- lock (this) {
+ lock (this_lock) {
if (urlToNode != null)
urlToNode.Clear ();
if (nodeToChildren != null)
@@ -194,7 +194,7 @@
if (node == null)
throw new ArgumentNullException("node");
- lock (this) {
+ lock (this_lock) {
SiteMapNode parent = (SiteMapNode) NodeToParent
[node];
if (NodeToParent.Contains (node))
NodeToParent.Remove (node);
Modified: trunk/mcs/class/System.Web/System.Web/TimeoutManager.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/TimeoutManager.cs 2007-08-08
09:12:49 UTC (rev 83647)
+++ trunk/mcs/class/System.Web/System.Web/TimeoutManager.cs 2007-08-08
09:36:02 UTC (rev 83648)
@@ -41,6 +41,8 @@
class TimeoutManager
{
+ object this_lock = new object();
+
Timer timer;
Hashtable contexts;
@@ -73,7 +75,7 @@
value = list;
}
- lock (this) {
+ lock (this_lock) {
contexts [context] = value;
}
}
@@ -85,7 +87,7 @@
return null;
if (value is Thread) {
- lock (this) {
+ lock (this_lock) {
contexts.Remove (context);
}
return (Thread) value;
@@ -99,7 +101,7 @@
}
if (list.Count == 0) {
- lock (this) {
+ lock (this_lock) {
contexts.Remove (context);
}
}
@@ -116,7 +118,7 @@
DateTime now = DateTime.UtcNow;
ArrayList clist = new ArrayList ();
- lock (this) { // The lock prevents Keys enumerator from
being out of synch
+ lock (this_lock) { // The lock prevents Keys enumerator
from being out of synch
clist.AddRange (contexts.Keys);
}
Modified: trunk/mcs/class/System.Web/System.Web/XmlSiteMapProvider.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/XmlSiteMapProvider.cs 2007-08-08
09:12:49 UTC (rev 83647)
+++ trunk/mcs/class/System.Web/System.Web/XmlSiteMapProvider.cs 2007-08-08
09:36:02 UTC (rev 83648)
@@ -45,6 +45,8 @@
public class XmlSiteMapProvider : StaticSiteMapProvider, IDisposable
{
static readonly char [] seperators = { ';', ',' };
+
+ object this_lock = new object ();
bool building;
string file;
SiteMapNode root = null;
@@ -87,7 +89,7 @@
if (building)
return null;
- lock (this) {
+ lock (this_lock) {
try {
building = true;
if (root != null)
Modified: trunk/mcs/class/System.Web/System.Web.Configuration/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Configuration/ChangeLog
2007-08-08 09:12:49 UTC (rev 83647)
+++ trunk/mcs/class/System.Web/System.Web.Configuration/ChangeLog
2007-08-08 09:36:02 UTC (rev 83648)
@@ -1,3 +1,10 @@
+2007-08-08 Marek Habersack <[EMAIL PROTECTED]>
+
+ * WebConfigurationSettings.cs: do not use lock (this), replace it
+ with lock (this_object), where this_object is an instance
+ variable. Prevents deadlocks in situation when external code locks
+ on the class instance.
+
2007-05-01 Marek Habersack <[EMAIL PROTECTED]>
* HttpCapabilitiesBase.cs: move the User-Agent code to a separate
Modified:
trunk/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs
2007-08-08 09:12:49 UTC (rev 83647)
+++
trunk/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs
2007-08-08 09:36:02 UTC (rev 83648)
@@ -141,6 +141,8 @@
//
class WebDefaultConfig : IConfigurationSystem
{
+ object this_lock = new object ();
+
#if TARGET_J2EE
static private WebDefaultConfig instance {
get {
@@ -263,7 +265,7 @@
if (initCalled)
return;
- lock (this) {
+ lock (this_lock) {
if (initCalled)
return;
@@ -372,6 +374,7 @@
class ConfigurationData
{
+ object this_lock = new object ();
ConfigurationData parent;
Hashtable factories;
Hashtable pending;
@@ -391,7 +394,7 @@
internal FileWatcherCache FileCache {
get {
- lock (this) {
+ lock (this_lock) {
if (fileCache != null)
return fileCache;
@@ -659,7 +662,7 @@
if (config != null)
return config;
- lock (this) {
+ lock (this_lock) {
config = GetConfigInternal (sectionName,
context, useLoc);
this.FileCache [sectionName] = (config == null)
? emptyMark : config;
}
Modified: trunk/mcs/class/System.Web/System.Web.SessionState/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.SessionState/ChangeLog
2007-08-08 09:12:49 UTC (rev 83647)
+++ trunk/mcs/class/System.Web/System.Web.SessionState/ChangeLog
2007-08-08 09:36:02 UTC (rev 83648)
@@ -1,3 +1,10 @@
+2007-08-08 Marek Habersack <[EMAIL PROTECTED]>
+
+ * SessionDictionary.cs: do not use lock (this), replace it
+ with lock (this_object), where this_object is an instance
+ variable. Prevents deadlocks in situation when external code locks
+ on the class instance.
+
2007-06-20 Marek Habersack <[EMAIL PROTECTED]>
* SessionInProcHandler.cs: use HttpRuntime.InternalCache to keep
Modified:
trunk/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs
2007-08-08 09:12:49 UTC (rev 83647)
+++ trunk/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs
2007-08-08 09:36:02 UTC (rev 83648)
@@ -35,6 +35,8 @@
internal class SessionDictionary : NameObjectCollectionBase
{
+ object this_lock = new object ();
+
public SessionDictionary ()
{
}
@@ -53,14 +55,14 @@
internal void Clear ()
{
- lock (this)
+ lock (this_lock)
BaseClear ();
}
internal string GetKey (int index)
{
string value;
- lock (this)
+ lock (this_lock)
value = BaseGetKey (index);
return value;
@@ -68,30 +70,30 @@
internal void Remove (string s)
{
- lock (this)
+ lock (this_lock)
BaseRemove (s);
}
internal void RemoveAt (int index)
{
- lock (this)
+ lock (this_lock)
BaseRemoveAt (index);
}
internal void Serialize (BinaryWriter writer)
- {
- writer.Write (Count);
- foreach (string key in base.Keys) {
- writer.Write (key);
- System.Web.Util.AltSerialization.Serialize (writer,
BaseGet (key));
+ {
+ writer.Write (Count);
+ foreach (string key in base.Keys) {
+ writer.Write (key);
+ System.Web.Util.AltSerialization.Serialize (writer,
BaseGet (key));
}
}
internal static SessionDictionary Deserialize (BinaryReader r)
{
- SessionDictionary result = new SessionDictionary ();
- for (int i = r.ReadInt32(); i > 0; i--)
- result [r.ReadString ()] =
+ SessionDictionary result = new SessionDictionary ();
+ for (int i = r.ReadInt32(); i > 0; i--)
+ result [r.ReadString ()] =
System.Web.Util.AltSerialization.Deserialize
(r);
return result;
@@ -101,14 +103,14 @@
{
get {
object o;
- lock (this)
+ lock (this_lock)
o = BaseGet (s);
return o;
}
set {
- lock (this)
+ lock (this_lock)
{
object obj = BaseGet(s);
if ((obj == null) && (value == null))
@@ -122,13 +124,13 @@
{
get {
object o;
- lock (this)
+ lock (this_lock)
o = BaseGet (index);
return o;
}
set {
- lock (this)
+ lock (this_lock)
{
object obj = BaseGet(index);
if ((obj == null) && (value == null))
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches