bug 687367 - disable DNS parallelism for android due to libc breakage r=bz, a=LegNeato
authorPatrick McManus <mcmanus@ducksong.com>
Wed, 12 Oct 2011 18:01:24 -0400
changeset 78329 4b3528fc67a8
parent 78328 90a4c98c1ae3
child 78330 b16983396f30
push id490
push userclegnitto@mozilla.com
push dateThu, 03 Nov 2011 00:33:29 +0000
treeherdermozilla-aurora@4b3528fc67a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, LegNeato
bugs687367
milestone9.0a2
bug 687367 - disable DNS parallelism for android due to libc breakage r=bz, a=LegNeato
netwerk/dns/nsHostResolver.cpp
netwerk/dns/nsHostResolver.h
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -80,18 +80,16 @@ using namespace mozilla;
 // the new request is at a lower priority a new thread will only be created if 
 // there are fewer than HighThreadThreshold currently outstanding. If a thread cannot be
 // created or an idle thread located for the request it is queued.
 //
 // When the pool is greater than HighThreadThreshold in size a thread will be destroyed after
 // ShortIdleTimeoutSeconds of idle time. Smaller pools use LongIdleTimeoutSeconds for a 
 // timeout period.
 
-#define MAX_NON_PRIORITY_REQUESTS 150
-
 #define HighThreadThreshold     MAX_RESOLVER_THREADS_FOR_ANY_PRIORITY
 #define LongIdleTimeoutSeconds  300           // for threads 1 -> HighThreadThreshold
 #define ShortIdleTimeoutSeconds 60            // for threads HighThreadThreshold+1 -> MAX_RESOLVER_THREADS
 
 PR_STATIC_ASSERT (HighThreadThreshold <= MAX_RESOLVER_THREADS);
 
 //----------------------------------------------------------------------------
 
--- a/netwerk/dns/nsHostResolver.h
+++ b/netwerk/dns/nsHostResolver.h
@@ -66,18 +66,30 @@ class nsResolveHostCallback;
     PRInt32 Release() {                                                      \
         PRInt32 n = NS_AtomicDecrementRefcnt(_refc);                         \
         NS_LOG_RELEASE(this, n, #classname);                                 \
         if (n == 0)                                                          \
             delete this;                                                     \
         return n;                                                            \
     }
 
+#ifdef ANDROID
+// See bug 687367 - pre gingerbread android has race conditions involving stdio.
+// stdio is used as part of the getaddrinfo() implementation. In order to reduce
+// that race window limit ourselves to 1 lookup at a time on android.
+
+#define MAX_RESOLVER_THREADS_FOR_ANY_PRIORITY  0
+#define MAX_RESOLVER_THREADS_FOR_HIGH_PRIORITY 1
+#define MAX_NON_PRIORITY_REQUESTS 0
+#else
 #define MAX_RESOLVER_THREADS_FOR_ANY_PRIORITY  3
 #define MAX_RESOLVER_THREADS_FOR_HIGH_PRIORITY 5
+#define MAX_NON_PRIORITY_REQUESTS 150
+#endif
+
 #define MAX_RESOLVER_THREADS (MAX_RESOLVER_THREADS_FOR_ANY_PRIORITY + \
                               MAX_RESOLVER_THREADS_FOR_HIGH_PRIORITY)
 
 struct nsHostKey
 {
     const char *host;
     PRUint16    flags;
     PRUint16    af;