RESOLVED FIXED Bug 38263
[Gtk] DNS prefetching trying to resolve empty host names, spamming syslog
https://bugs.webkit.org/show_bug.cgi?id=38263
Summary [Gtk] DNS prefetching trying to resolve empty host names, spamming syslog
Michael Gratton
Reported 2010-04-28 07:42:08 PDT
WebKitGTK+ v1.2.0 (Ubuntu lucid libwebkit-1.0-2 1.2.0-1) Webkit is causing programs that embed it to spam syslog with this sort of thing: > Apr 29 00:17:01 localhost epiphany-browser: gethostby*.getanswer: asked for "", got "." > Apr 29 00:18:07 localhost epiphany-browser: last message repeated 527 times > Apr 29 00:19:08 localhost epiphany-browser: last message repeated 1178 times > Apr 29 00:20:09 localhost epiphany-browser: last message repeated 1300 times > Apr 29 00:21:18 localhost epiphany-browser: last message repeated 1341 times > Apr 29 00:22:27 localhost epiphany-browser: last message repeated 715 times > Apr 29 00:23:27 localhost epiphany-browser: last message repeated 1307 times > Apr 29 00:24:27 localhost epiphany-browser: last message repeated 863 times > Apr 29 00:25:27 localhost epiphany-browser: last message repeated 989 times > Apr 29 00:26:27 localhost epiphany-browser: last message repeated 534 times It looks like the DNS prefetching code is causing null/empty host names to be resolved, which explains the syslog entry. A typical stack trace is below. Note the call to g_resolver_lookup_by_name_async at the top with an empty hostname param. I'm not sure where the best place to guard against this is, perhaps both GIO and Soup should be ignoring/erroring when invoked to resolve an empty host name, but libwebkitgtk probably shouldn't be attempting to prefetch links without a valid URI host part anyway. #0 IA__g_resolver_lookup_by_name_async (resolver=0x20ef780, hostname=0x39cace0 "", cancellable=0x0, callback=0x7fac17c2a2a0, user_data=0x3516450) at /build/buildd/glib2.0-2.24.0/gio/gresolver.c:299 #1 0x00007fac17c2a18d in soup_address_resolve_async () from /usr/lib/libsoup-2.4.so.1 #2 0x00007fac1904ee49 in WebCore::prefetchDNS (hostname=<value optimised out>) at ../WebCore/platform/network/soup/DNSSoup.cpp:44 #3 0x00007fac18d11670 in WebCore::Chrome::mouseDidMoveOverElement ( this=0x7fabfd8e63c0, result=..., modifierFlags=27303232) at ../WebCore/page/Chrome.cpp:340 #4 0x00007fac18d2bd46 in WebCore::EventHandler::mouseMoved ( this=<value optimised out>, event=...) at ../WebCore/page/EventHandler.cpp:1332 #5 0x00007fac19084055 in webkit_web_view_motion_event ( widget=<value optimised out>, event=0x7fabe5c9a350) at ../WebKit/gtk/webkit/webkitwebview.cpp:654 #6 0x00007fac17fab0b8 in _gtk_marshal_BOOLEAN__BOXED (closure=0x1a09d40, return_value=0x7fffad3488b0, n_param_values=<value optimised out>, param_values=0x429a320, invocation_hint=<value optimised out>, marshal_data=0x7fac19083ff0) at /build/buildd/gtk+2.0-2.20.0/gtk/gtkmarshalers.c:84 #7 0x00007fac16d925de in IA__g_closure_invoke (closure=0x1a09d40, return_value=0x7fffad3488b0, n_param_values=2, param_values=0x429a320, ---Type <return> to continue, or q <return> to quit--- invocation_hint=0x7fffad348870) at /build/buildd/glib2.0-2.24.0/gobject/gclosure.c:767 #8 0x00007fac16da61dd in signal_emit_unlocked_R (node=0x1a09db0, detail=<value optimised out>, instance=<value optimised out>, emission_return=<value optimised out>, instance_and_params=<value optimised out>) at /build/buildd/glib2.0-2.24.0/gobject/gsignal.c:3286 #9 0x00007fac16da78b9 in IA__g_signal_emit_valist (instance=0x7fabe5e2c810, signal_id=<value optimised out>, detail=0, var_args=0x7fffad348a60) at /build/buildd/glib2.0-2.24.0/gobject/gsignal.c:2991 #10 0x00007fac16da8033 in IA__g_signal_emit (instance=0x20ef780, signal_id=60599520, detail=0) at /build/buildd/glib2.0-2.24.0/gobject/gsignal.c:3038 #11 0x00007fac180c1e9f in gtk_widget_event_internal (widget=0x7fabe5e2c810, event=0x7fabe5c9a350) at /build/buildd/gtk+2.0-2.20.0/gtk/gtkwidget.c:4951 #12 0x00007fac17fa3583 in IA__gtk_propagate_event (widget=0x7fabe5e2c810, event=0x7fabe5c9a350) at /build/buildd/gtk+2.0-2.20.0/gtk/gtkmain.c:2447 #13 0x00007fac17fa465b in IA__gtk_main_do_event (event=0x7fabe5c9a350) at /build/buildd/gtk+2.0-2.20.0/gtk/gtkmain.c:1647 #14 0x00007fac179c580c in gdk_event_dispatch (source=<value optimised out>, callback=<value optimised out>, user_data=<value optimised out>) at /build/buildd/gtk+2.0-2.20.0/gdk/x11/gdkevents-x11.c:2372 #15 0x00007fac166dd8c2 in g_main_dispatch (context=0x1a06310) ---Type <return> to continue, or q <return> to quit--- at /build/buildd/glib2.0-2.24.0/glib/gmain.c:1960 #16 IA__g_main_context_dispatch (context=0x1a06310) at /build/buildd/glib2.0-2.24.0/glib/gmain.c:2513 #17 0x00007fac166e1748 in g_main_context_iterate (context=0x1a06310, block=<value optimised out>, dispatch=<value optimised out>, self=<value optimised out>) at /build/buildd/glib2.0-2.24.0/glib/gmain.c:2591 #18 0x00007fac166e1c55 in IA__g_main_loop_run (loop=0x1ab9fb0) at /build/buildd/glib2.0-2.24.0/glib/gmain.c:2799 #19 0x00007fac17fa4af7 in IA__gtk_main () at /build/buildd/gtk+2.0-2.20.0/gtk/gtkmain.c:1219 #20 0x0000000000435423 in main (argc=1, argv=0x7fffad349fd8) at /build/buildd/epiphany-browser-2.30.2/src/ephy-main.c:741
Attachments
Check hostname is non-empty before DNS prefetch (467 bytes, patch)
2010-04-29 18:39 PDT, Michael Gratton
no flags
Alexey Proskuryakov
Comment 1 2010-04-28 10:52:10 PDT
We have the following in DNSCFNet.cpp (used in CFNetwork-based ports): if (hostname.isEmpty()) return;
Michael Gratton
Comment 2 2010-04-29 18:39:39 PDT
Created attachment 54769 [details] Check hostname is non-empty before DNS prefetch Per Alexey's suggestion, this adds an empty check on the hostname string before calling Soup to prefetch. This patch fixes the problem for me.
Sergio Villar Senin
Comment 3 2010-10-26 03:07:33 PDT
(In reply to comment #2) > Created an attachment (id=54769) [details] > Check hostname is non-empty before DNS prefetch > > Per Alexey's suggestion, this adds an empty check on the hostname string before calling Soup to prefetch. > > This patch fixes the problem for me. Michael could you please include the proper changelog to the patch? There is some infor here http://webkit.org/coding/contributing.html. And do not forget to set the review flag to "?". Adding Xan to the Cc BTW
Gustavo Noronha (kov)
Comment 4 2011-04-09 05:14:36 PDT
Is this now obsolete? After 56128 the way this is done is completely different for the GTK+ port, and I was unable to identify at a glance if we would still be able to suffer from the same problem. Can the URL passed to prepareForURL lack a host?
Michael Gratton
Comment 5 2011-05-11 17:18:45 PDT
I'm not getting the syslog spam any more with webkit 1.4, soup 2.34 and glib 2.28, but I guess that's not to say the problem isn't still there. Gustavo, bug #56128 doesn't seem relevant?
Gustavo Noronha (kov)
Comment 6 2011-05-11 17:24:37 PDT
(In reply to comment #5) > Gustavo, bug #56128 doesn't seem relevant? I meant revision 56128: http://trac.webkit.org/changeset/56128
Michael Gratton
Comment 7 2011-05-11 18:37:13 PDT
(In reply to comment #6) > > I meant revision 56128: http://trac.webkit.org/changeset/56128 Oh, of course, thanks. Well, that revision uses soup_session_prepare_for_uri() for the DNS prefetching, and that function (in libsoup git master anyway) does a null check on the host, so this can probably be resolved as invalid or wontfix now.
Michael Gratton
Comment 8 2011-05-11 19:19:43 PDT
One note, possibly for another bug: Since HTMLAnchorElement::parseMappedAttribute calls ResourceHandle::prepareForURL, whenever an anchor element's href attribute is changed (which I assume also happens when the element is first parsed), loading a page will cause every anchor's href to be prefetched. This doesn't strike me as being very desirable, but I guess that is a WebKit issue in general.
Gustavo Noronha (kov)
Comment 9 2011-05-12 06:12:46 PDT
Well, fixed, just by a different patch, then =)
Note You need to log in before you can comment on or make changes to this bug.