Subject: Re: mozilla hanging resolving host names
To: None <wiz@NetBSD.org, tech-pkg@NetBSD.org>
From: Kouichirou Hiratsuka <hira@po6.nsk.ne.jp>
List: tech-pkg
Date: 02/20/2004 00:15:25
Hello,

At Sat, 31 Jan 2004 01:23:37 +0100,
Thomas Klausner wrote:
>
> Since the update to 1.6 (I don't remember seeing it before)
> mozilla sometimes hangs when loading a page; the message in
> the status bar is 'Resolving XXX' where XXX is the hostname
> of the page I want to visit.
> This always happens for me after some time; when it happens,
> getting new pages from mozilla is not possible, I have to restart
> it.
> It doesn't always take the same time before it happens, but
> it usually happens quite quickly.
> 
I have same problem on mozilla-gtk2-1.6nb1. When I opened a lot of tabs
all at once, it has happened. It hungs at getaddrinfo(3).
IMHO, in mozilla/nsprpub/pr/src/misc/prnetdb.c, DNS lock/unlock is necessary
for getaddrinfo(3). Please try a following patch. On my system mozilla seems
to be fine with this patch.

best regards.

--
 Kouichirou Hiratsuka
   hira@po6.nsk.ne.jp

--- nsprpub/pr/src/misc/prnetdb.c.orig	2004-02-19 21:45:15.000000000 +0900
+++ nsprpub/pr/src/misc/prnetdb.c	2004-02-19 21:50:57.000000000 +0900
@@ -2094,7 +2094,12 @@
          */
         hints.ai_socktype = SOCK_STREAM;
 
+        LOCK_DNS();
+
         rv = GETADDRINFO(hostname, NULL, &hints, &res);
+
+        UNLOCK_DNS();
+
         if (rv == 0)
             return (PRAddrInfo *) res;