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 ()
#2 0x00007fac1904ee49 in WebCore::prefetchDNS (hostname=<value optimised out>)
#3 0x00007fac18d11670 in WebCore::Chrome::mouseDidMoveOverElement (
this=0x7fabfd8e63c0, result=..., modifierFlags=27303232)
#4 0x00007fac18d2bd46 in WebCore::EventHandler::mouseMoved (
this=<value optimised out>, event=...)
#5 0x00007fac19084055 in webkit_web_view_motion_event (
widget=<value optimised out>, event=0x7fabe5c9a350)
#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>,
#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---
#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>)
#9 0x00007fac16da78b9 in IA__g_signal_emit_valist (instance=0x7fabe5e2c810,
signal_id=<value optimised out>, detail=0, var_args=0x7fffad348a60)
#10 0x00007fac16da8033 in IA__g_signal_emit (instance=0x20ef780,
#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)
#14 0x00007fac179c580c in gdk_event_dispatch (source=<value optimised out>,
callback=<value optimised out>, user_data=<value optimised out>)
#15 0x00007fac166dd8c2 in g_main_dispatch (context=0x1a06310)
---Type <return> to continue, or q <return> to quit---
#16 IA__g_main_context_dispatch (context=0x1a06310)
#17 0x00007fac166e1748 in g_main_context_iterate (context=0x1a06310,
block=<value optimised out>, dispatch=<value optimised out>,
self=<value optimised out>)
#18 0x00007fac166e1c55 in IA__g_main_loop_run (loop=0x1ab9fb0)
#19 0x00007fac17fa4af7 in IA__gtk_main ()
#20 0x0000000000435423 in main (argc=1, argv=0x7fffad349fd8)
We have the following in DNSCFNet.cpp (used in CFNetwork-based ports):
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.
(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
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?
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?
(In reply to comment #5)
> Gustavo, bug #56128 doesn't seem relevant?
I meant revision 56128: http://trac.webkit.org/changeset/56128
(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.
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.
Well, fixed, just by a different patch, then =)