After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 76283 - gweather fails to display if DNS failed
gweather fails to display if DNS failed
Status: RESOLVED FIXED
Product: gnome-vfs
Classification: Deprecated
Component: Module: http
2.2.x
Other other
: High major
: ---
Assigned To: gnome-vfs maintainers
gnome-vfs maintainers
AES[BADBUG]
: 71199 90111 96161 108690 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-03-25 17:39 UTC by jacob berkman
Modified: 2005-01-06 10:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (2.08 KB, patch)
2003-01-18 11:14 UTC, Christophe Fergeau
none Details | Review
Here we go! (17.05 KB, patch)
2004-07-22 10:59 UTC, Christian Kellner
none Details | Review
patch to reload resolver on error (20.48 KB, patch)
2004-07-30 08:44 UTC, Christian Kellner
none Details | Review
patch committed with CVS (7.74 KB, patch)
2004-07-31 13:52 UTC, Christophe Fergeau
none Details | Review

Description jacob berkman 2002-03-25 17:39:48 UTC
if gweather is started before a network interface is brought up, it will
never display anything.

if my panel starts up before i bring up my network interface, i have to
restart the panel for gweather to work.
Comment 1 Kevin Vandersloot 2002-03-26 02:15:20 UTC
Hmm, there is something very fishy about gweather. I get this also,
but only on occasion.

This is heinous, marking up the severity
Comment 2 Luis Villa 2002-05-01 10:50:22 UTC
Would be great to have a fix before 2.0.0 but not a showstopper IMHO.
Comment 3 arunapr 2002-07-08 10:32:22 UTC
I tried reproducing this bug, brought down the network interface,
started the panel, tried updating the gweather it failed. Later
brought up the network interface and tried updating the gweather, it
successfully updated. I didn't restart the panel for gweather to
successfully update. 


    	
Comment 4 Ross Golder 2002-07-08 21:41:56 UTC
Funny that. Don't know if it's related, I have a couple of inbox
monitor applets on my panel. If I start up my laptop without the
network connected, even after connecting to the network and checking
my mail with Evolution, they refuse to connect. This doesn't happen
every time for me either. In fact, strangely enough, it starts working
fine every time I go to investigate ;oP

--
Ross
Comment 5 Miguel Rodríguez 2002-07-13 17:00:36 UTC
The real problem is that gweather reads /etc/resolv when it starts,
but doesn't reread it if it changes after the network connection is up.
If you have a dial-up connection you probably rewrite /etc/resolv when
you connect, but gweather ignores this. (Well, in fact it's glibc that
ignores this).
Comment 6 Deepa Chacko Pillai 2002-08-08 11:05:26 UTC
This is what I observed:
* I do a network shutdown 'sh network stop'. Start the panel.
Add the applet and update. It gives retrieval failed. Now I start the
network 'sh network start'. When I do an update for the applet, it
displays the required information.
* I commented out the nameserver info. in /etc/resolv.conf. Start the
panel. Add the applet. It gives retrieval failed. Now I uncommented
out the nameserver info. When I do an update, it still gives retrieval
failed. But if I remove the applet from the panel and add it back, the
applet displays the information.
It is the same behaviour for stock-ticker applet too. I don't think
the problem is in the applet. gnome_vfs_inet_connection_create ()
returns error because gethostbyname returns NULL. gethostbyname ()
reads /etc/resolv.conf only when it is called for the first time,ie.
when adding the applet to the panel. Further calls to gethostbyname ()
seems to not read /etc/resolv.conf. I did a strace of gweather, but
could not locate any open of /etc/resolv.conf after the first one.
Hence it fails to detect any changes to /etc/resolv.conf after the
applet is added to the panel. 

However, this works on Solaris. truss output on solaris shows that it
reads the /etc/resolv.conf every time I do an update.
Hence, I feel this is a problem with the behaviour of gethostbyname
and not a problem with the applets.
Comment 7 Kevin Vandersloot 2002-08-09 19:47:41 UTC
Both gweather and stock-ticker use gnome-vfs for network retreival. 
Any network issues are because of gnome-vfs. Personally I use dial-up 
for network connection and gweather works okay for me even though I'm 
often not connected.
Comment 8 Mark McLoughlin 2002-08-12 02:52:33 UTC
Kevin: should this bug be moved to gnome-vfs then ?
Comment 9 jacob berkman 2002-08-12 14:11:56 UTC
yeah it's probably a gnome-vfs bug.

i remember chris or shaver mentioning about this bug in mozilla - i
guess there's some api call in glibc to reload /etc/resolv.conf, and
you can do this after (1) failed dns lookup.
Comment 10 Miguel Rodríguez 2002-08-17 10:23:14 UTC
The relevant bugs at bugzilla.mozilla.org are 64857 and 117628, and
the api call is res_init(3). And according to the bug report you have
to unset the RES_INIT bit in _res.options to make libc reread
/etc/resolv.conf.

Hope this helps.
Comment 11 Luis Villa 2002-08-19 19:27:24 UTC
*** Bug 71199 has been marked as a duplicate of this bug. ***
Comment 12 Luis Villa 2002-08-19 19:28:34 UTC
Thanks for looking that up, Miguel.
Comment 13 Christopher Blizzard 2002-08-20 03:23:17 UTC
Yeah, res_init() is the call that you need to make.  Mozilla just
makes it whenever there's a DNS failure.
Comment 14 Joe Shaw 2002-10-23 14:57:50 UTC
Could this be the cause of my perpetually updating gweather?  It has
the question mark icon and 52 degrees (it's snowing and 36 here now.
:), and the tooltip says "Updating..."  No matter how many times I
right-click on it and tell it to update, it never goes out and gets
it.  If I change the location, though, it seems to work, and I can
then change it back.

If it's not caused by this, I'll open another bug.
Comment 15 Luis Villa 2002-11-21 17:16:51 UTC
*** Bug 96161 has been marked as a duplicate of this bug. ***
Comment 16 Luis Villa 2002-11-21 17:18:42 UTC
Blah. Still a problem in 2.1.x, still irritating as all get out and
making things break.
Comment 17 Christophe Fergeau 2003-01-17 23:27:57 UTC
In an attempt to fix this bug, I looked at the two mozilla bugs
mentioned in this bug report, I also found #166479 which is related.
Here is a quick summary of my readings: res_ninit should be preferred
to res_init since the former is thread safe. The problem is that
res_ninit only appeared with glibc 2.2 (which rh6 doesn't have for
instance).

I think this bug could be fixed by calling res_ninit when a dns lookup
fails, and retrying the lookup after that. As mentionned in the
mozilla bugs, if one moves from one network to another, and the dns of
the first network is accessible from the second one, dns requests will
travel from the second network to the first unnecessarily. But the
most annoying problem will be fixed :)

It should probably be enough to add this res_ninit in
gnome_vfs_inet_connection_create after the get_host_by_name, I'll try
to make a patch tomorrow
Comment 18 Christophe Fergeau 2003-01-18 11:14:14 UTC
Created attachment 13660 [details] [review]
proposed patch
Comment 19 Christophe Fergeau 2003-01-18 11:15:31 UTC
I haven't tested at all this patch (apart from checking if it compiles
and if gweather still works), but I'd expect it to fix this gweather
problem. Can someone who was seeing the problem test it ?
Comment 20 Christopher Blizzard 2003-01-18 15:41:57 UTC
You should look at the updated mozilla source code.  There's a more
portable way that works with a whole bunch of different versions of
glibc. (I think you have to call _res_init() instead of res_init() but
I can't remember the details clearly.)
Comment 21 Christophe Fergeau 2003-01-20 09:26:35 UTC
I looked at mozilla source code (in
mozilla/netwerk/dns/src/nsDnsService.cpp), and I only found a hack  to
be able to use res_ninit (on platforms which have it) even if the
binary was compiled on a machine which had a libc without it (I guess
that is meant to be used to build the nightly builds on rh6.2 or some
older distro while being able to take advantage of res_ninit when run
on rh7). This doesn't look like something necessary for gnome.

Comment 22 paolo 2003-03-20 20:19:08 UTC
*** Bug 108690 has been marked as a duplicate of this bug. ***
Comment 23 Elijah Newren 2003-03-20 20:21:00 UTC
*** Bug 108690 has been marked as a duplicate of this bug. ***
Comment 24 paolo 2003-04-04 20:55:04 UTC
did anyone check if the patch really works?
Comment 25 Alexander Larsson 2003-04-23 11:22:19 UTC
The patch seems basically all right, but it doesn't fix the whole issue.
gethostbyname() and getaddrinfo() is called from several other places,
and on some systems there are threadsafeness issues with gethostbyname().

I think the correct way to fix this is to add a common resolver call
in gnome-vfs that is threadsafe and supports IPV6 and res_ninit. Then
we use this function in all the places where we now do getaddrinfo()
and gethostbyname().

teuf, are you interested in this? It requires some thinking about the
API so that all users in gnome-vfs get what they want and it can be
implemented threadsafely using whatever calls the OS offers.
Comment 26 Alexander Larsson 2003-04-23 11:23:13 UTC
For info about threadsafeness issues, read resolv/README in the glibc
sources.
Comment 27 Joe Shaw 2003-04-23 14:42:39 UTC
I believe there's a threadsafe gethostbyname() in libsoup which should work on at 
least Solaris and Linux.  You might want to look at that.
Comment 28 Alexander Larsson 2003-04-23 15:41:36 UTC
gethostbyname() is actually threadsafe in glibc 2.2, since the data
used is stored in thread-specific data. However, this is not true for
all systems, so there are thread-safe extensions that you can use, and
in the end fall-back to locking around gethostbyname(). 

I haven't looked at the libsoup resolver, but if it is a complete
independent resolver-implementation that sounds a bit overkill, and
will cause problems with e.g. having to update it for IPV6 etc.
Comment 29 Joe Shaw 2003-04-23 15:55:23 UTC
It's not a complete reimplementation, it uses native gethostbyname_r() in glibc, on 
solaris and hp/ux and does locking around gethostbyname() when those aren't 
available.  And it handles IPv6.
Comment 30 Kjartan Maraas 2003-07-09 12:57:10 UTC
So do we cut'n'paste it from libsoup?
Comment 31 Christophe Fergeau 2003-07-18 12:51:16 UTC
Mass resetting target milestone to clean up gnome-vfs milestones. Please
complain if I removed a milestone which should have been kept. Sorry for the spam 
Comment 32 Alexander Larsson 2003-09-16 14:26:55 UTC
We really should have a threadsafe resolver in gnome-vfs and use it
from  everywhere. One that supported async resolving would be nice also.
Comment 33 Luis Villa 2004-02-22 18:38:27 UTC
This is a really bad bug for laptop users; it'd be really nice if we
could finally get it fixed, even if the fix is suboptimal.
Comment 34 Christian Kellner 2004-07-22 10:56:37 UTC
As I added a generic resolver API for gnome-vfs now, I am adding support for
resolver reloading to this new API. I modified the autoconf stuff to pick up the
proper library if necessary and reorded the whole resolver part that only
libresolve links against the resolver libraries if neccessary. I also added a
maximum reload interval. (The idea is based on mozilla code :)
Comment 35 Christian Kellner 2004-07-22 10:59:18 UTC
Created attachment 29782 [details] [review]
Here we go!
Comment 36 Christian Kellner 2004-07-22 11:00:38 UTC
Sorry .. not "that only libresolve" but "that only libgnomevfs" .. sorry for the
spam.
Comment 37 Christian Kellner 2004-07-30 08:44:27 UTC
Created attachment 30059 [details] [review]
patch to reload resolver on error

Updated version (I have tested this version and it works for me)! If somebody
could test it and report me any errors, that would be great! :)
Comment 38 Christophe Fergeau 2004-07-31 13:52:10 UTC
Created attachment 30106 [details] [review]
patch committed with CVS

Here is the latest update of the patch which was committed to CVS. I feared the
previous patch could go in an unfinite loop, so gicmo changed it so that
res_ninit is called at most once for each resolving call.
Comment 39 Christophe Fergeau 2004-07-31 13:53:41 UTC
The configure.in changes are the same as in attachment #30059 [details].
Can anyone test whether this patch helps or not (gnome-vfs > 2.7.5 is needed)
Comment 40 Kjartan Maraas 2005-01-06 10:09:50 UTC
*** Bug 90111 has been marked as a duplicate of this bug. ***