Avoid deadlocking when getting the ServicePoint
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 24 Apr 2012 08:52:22 +0000 (04:52 -0400)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 24 Apr 2012 08:54:54 +0000 (04:54 -0400)
SSL connections were deadlocking when getting the service point for the
connection in the last few releases of 2.10.x and in master.

Fixes bug #4599.

mcs/class/System/System.Net/HttpWebRequest.cs
mcs/class/System/System.Net/ServicePointManager.cs

index 483e2b81dbdaf25adc1efbad7847125cf6eacd74..86342a53680bec0f47c586aeb81101d93aac6c0e 100644 (file)
@@ -553,6 +553,10 @@ namespace System.Net
                public ServicePoint ServicePoint {
                        get { return GetServicePoint (); }
                }
+
+               internal ServicePoint ServicePointNoLock {
+                       get { return servicePoint; }
+               }
                
                public override int Timeout { 
                        get { return timeout; }
index 16292185200d4842f0cb378714d6fc585ca129ff..3e35e93a867020fca08fd47404f30aa09851b73d 100644 (file)
@@ -540,7 +540,7 @@ namespace System.Net
                                        ServicePoint sp = null;
                                        HttpWebRequest req = sender as HttpWebRequest;
                                        if (req != null)
-                                               sp = req.ServicePoint;
+                                               sp = req.ServicePointNoLock;
                                        if (status11 == 0 && errors != 0)
                                                status11 = GetStatusFromChain (chain);