bug 687367 - disable DNS parallelism for android due to libc breakage r=bz
authorPatrick McManus <mcmanus@ducksong.com>
Wed, 12 Oct 2011 18:01:24 -0400
changeset 78658 332bc69d0f2d
parent 78657 92db762bf8d6
child 78659 ccf5c0a8c37b
push id21321
push usermak77@bonardo.net
push dateThu, 13 Oct 2011 13:50:30 +0000
treeherdermozilla-central@d6d3a1f90e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs687367
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 687367 - disable DNS parallelism for android due to libc breakage r=bz
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;