Bug 79036 - [GTK] Adding SOUP_TYPE_PROXY_RESOLVER_DEFAULT feature to soup session makes WebProcess to hang
Summary: [GTK] Adding SOUP_TYPE_PROXY_RESOLVER_DEFAULT feature to soup session makes W...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-20 10:01 PST by Carlos Garcia Campos
Modified: 2012-02-20 10:45 PST (History)
2 users (show)

See Also:


Attachments
Patch (1.73 KB, patch)
2012-02-20 10:34 PST, Carlos Garcia Campos
mrobinson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2012-02-20 10:01:32 PST
The web process hangs sometimes (1 out of 4 times or so for me). The problem can be reproduced running TestWebKitWebView unit test, it usually hangs in replace-content test, since it's when the web process finishes launching. I don't have a backtrace, but it hangs creating a GSocket in g_socket_class_init() while installing the local-adress property. Since glib version hasn't changed I've bisectd webkit and I've found the commit that introduces the problem is this one:

http://trac.webkit.org/changeset/107973

That commit not only moves code, but it also adds SOUP_TYPE_PROXY_RESOLVER_DEFAULT to the default session in webkit2. I have no idea why, but just removing that feature fixes the hang.
Comment 1 Carlos Garcia Campos 2012-02-20 10:19:37 PST
The problem is that g_socket_address_get_type() is called from two threads at the same time, causing a deadlock. This happens when the proxy resolver tries to get settings from dconf using dbus and WebKit creates the socket to communicate with the ui process.


(gdb) thread apply all bt

Hilo 4 (Thread 0xb34ecb70 (LWP 736)):
#0  0xb78670c2 in ?? () from /lib/ld-linux.so.2
#1  0xb600ba5c in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:169
#2  0xb60fccfc in __pthread_cond_wait (cond=0xb5ff4b30, mutex=0xb5ff4b18) at forward.c:139
#3  0xb5f2f3b7 in WTF::TCMalloc_PageHeap::scavengerThread() () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/.libs/libjavascriptcoregtk-3.0.so.0
#4  0xb5f2f3eb in WTF::TCMalloc_PageHeap::runScavengerThread(void*) () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/.libs/libjavascriptcoregtk-3.0.so.0
#5  0xb6007d31 in start_thread (arg=0xb34ecb70) at pthread_create.c:304
#6  0xb60ef0ce in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Backtrace stopped: Not enough registers or memory available to unwind further

Hilo 3 (Thread 0xb2b7fb70 (LWP 737)):
#0  0xb78670c2 in ?? () from /lib/ld-linux.so.2
#1  0xb600e619 in __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/lowlevellock.S:142
#2  0xb6009f8b in _L_lock_786 () from /lib/i386-linux-gnu/libpthread.so.0
#3  0xb6009e45 in __pthread_mutex_lock (mutex=0x8caea18) at pthread_mutex_lock.c:82
#4  0xb60fcf14 in pthread_mutex_lock (mutex=0x8caea18) at forward.c:182
#5  0xb4df0051 in g_rec_mutex_lock (mutex=0xb4ee37d8) at gthread-posix.c:377
#6  0xb4ec5a1c in g_type_add_interface_static (instance_type=147614440, interface_type=2988451928, info=0xb2b7ed54) at gtype.c:2820
#7  0xb527bee1 in g_socket_address_get_type () at gsocketaddress.c:72
#8  0xb52a1697 in g_unix_socket_address_get_type () at gunixsocketaddress.c:60
#9  0xb52a1bd7 in g_unix_socket_address_new_with_type (path=0xb2202bd0 "/tmp/dbus-XJs6xBqlfx", path_len=<optimized out>, type=G_UNIX_SOCKET_ADDRESS_ABSTRACT) at gunixsocketaddress.c:426
#10 0xb52c232b in g_dbus_address_connect (error=0xb2b7eeac, cancellable=0x0, key_value_pairs=<optimized out>, transport_name=0x0, address_entry=<optimized out>) at gdbusaddress.c:569
#11 g_dbus_address_try_connect_one (address_entry=<optimized out>, out_guid=0x0, cancellable=0x0, error=0xb2b7eeac) at gdbusaddress.c:767
#12 0xb52c3290 in g_dbus_address_get_stream_sync (address=0x8de9620 "unix:abstract=/tmp/dbus-XJs6xBqlfx,guid=458e9885cf5d14ba635cab810000005c", out_guid=0x0, cancellable=0x0, 
    error=0x8de9884) at gdbusaddress.c:961
#13 0xb52d5273 in initable_init (initable=0x8de9848, cancellable=0x0, error=0xb2b7efdc) at gdbusconnection.c:2528
#14 0xb525e502 in g_initable_init (initable=0x8de9848, cancellable=0x0, error=0xb2b7efdc) at ginitable.c:115
#15 0xb52d5865 in g_bus_get_sync (bus_type=G_BUS_TYPE_SESSION, cancellable=0x0, error=0xb2b7efdc) at gdbusconnection.c:6794
#16 0xb353067c in ?? () from /usr/lib/gio/modules/libdconfsettings.so
#17 0xb3530b67 in ?? () from /usr/lib/gio/modules/libdconfsettings.so
#18 0xb4dae5a0 in g_idle_dispatch (source=0x8cc80e0, callback=0xb3530b10, user_data=0x8de2d68) at gmain.c:4629
#19 0xb4db0b3a in g_main_dispatch (context=0x8cc76b0) at gmain.c:2510
#20 g_main_context_dispatch (context=0x8cc76b0) at gmain.c:3047
#21 0xb4db0f45 in g_main_context_iterate (dispatch=1, block=-1260656432, context=0x8cc76b0, self=<optimized out>) at gmain.c:3118
#22 g_main_context_iterate (context=0x8cc76b0, block=-1260656432, dispatch=1, self=<optimized out>) at gmain.c:3055
#23 0xb4db138b in g_main_loop_run (loop=0xb2200478) at gmain.c:3312
#24 0xb3530194 in ?? () from /usr/lib/gio/modules/libdconfsettings.so
#25 0xb4dd41c3 in g_thread_proxy (data=0x8cd7860) at gthread.c:801
#26 0xb6007d31 in start_thread (arg=0xb2b7fb70) at pthread_create.c:304
#27 0xb60ef0ce in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Backtrace stopped: Not enough registers or memory available to unwind further

Hilo 2 (Thread 0xb21ffb70 (LWP 738)):
#0  0xb78670c2 in ?? () from /lib/ld-linux.so.2
#1  0xb60e040e in __GI___poll (fds=0xb2202818, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0xb4dbe8fb in g_poll (fds=0xb2202818, nfds=1, timeout=-1) at gpoll.c:132
#3  0xb4db0ece in g_main_context_poll (n_fds=1, fds=0xb2202818, timeout=<optimized out>, context=0x8de7600, priority=<optimized out>) at gmain.c:3412
#4  g_main_context_iterate (dispatch=1, block=-1260656432, context=0x8de7600, self=<optimized out>) at gmain.c:3113
#5  g_main_context_iterate (context=0x8de7600, block=-1260656432, dispatch=1, self=<optimized out>) at gmain.c:3055
#6  0xb4db138b in g_main_loop_run (loop=0x8caf0c8) at gmain.c:3312
---Type <return> to continue, or q <return> to quit---
#7  0xb6311b5e in WorkQueue::workQueueThreadBody() () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/.libs/libwebkit2gtk-3.0.so.0
#8  0xb6311b8b in WorkQueue::startWorkQueueThread(WorkQueue*) () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/.libs/libwebkit2gtk-3.0.so.0
#9  0xb5f50332 in WTF::threadEntryPoint(void*) () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/.libs/libjavascriptcoregtk-3.0.so.0
#10 0xb5f5049e in WTF::wtfThreadEntryPoint(void*) () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/.libs/libjavascriptcoregtk-3.0.so.0
#11 0xb6007d31 in start_thread (arg=0xb21ffb70) at pthread_create.c:304
#12 0xb60ef0ce in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Backtrace stopped: Not enough registers or memory available to unwind further

Hilo 1 (Thread 0xb368a890 (LWP 733)):
#0  0xb78670c2 in ?? () from /lib/ld-linux.so.2
#1  0xb600ba5c in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:169
#2  0xb60fccfc in __pthread_cond_wait (cond=0x8cae5c0, mutex=0x8cad730) at forward.c:139
#3  0xb4df02f6 in g_cond_wait (cond=0xb4e89aa0, mutex=0xb4e89a98) at gthread-posix.c:746
#4  0xb4dd436c in g_once_init_enter (location=0xb536916c) at gthread.c:686
#5  0xb527be5e in g_socket_address_get_type () at gsocketaddress.c:72
#6  0xb5276893 in g_socket_class_init (klass=0x8de9680) at gsocket.c:825
#7  g_socket_class_intern_init (klass=0x8de9680) at gsocket.c:125
#8  0xb4ec326f in type_class_init_Wm (pclass=0x8cb4728, node=0xb22028a8) at gtype.c:2219
#9  g_type_class_ref (type=2988452008) at gtype.c:2925
#10 0xb4eaa66f in g_object_new_valist (object_type=2988452008, first_property_name=0xb531edd2 "fd", var_args=0xbfda2770 "\a") at gobject.c:1791
#11 0xb525e62d in g_initable_new_valist (object_type=2988452008, first_property_name=0xb531edd2 "fd", var_args=0xbfda2770 "\a", cancellable=0x0, error=0x0) at ginitable.c:224
#12 0xb525e6eb in g_initable_new (object_type=2988452008, cancellable=0x0, error=0x0, first_property_name=0xb531edd2 "fd") at ginitable.c:148
#13 0xb5277b1f in g_socket_new_from_fd (fd=7, error=0x0) at gsocket.c:1032
#14 0xb6311f09 in WorkQueue::registerEventSourceHandler(int, int, WTF::Function<void ()> const&) () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/.libs/libwebkit2gtk-3.0.so.0
#15 0xb631049f in CoreIPC::Connection::open() () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/.libs/libwebkit2gtk-3.0.so.0
#16 0xb644c8a4 in WebKit::WebProcess::initialize(int, WebCore::RunLoop*) () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/.libs/libwebkit2gtk-3.0.so.0
#17 0xb63e2842 in WebProcessMainGtk () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/.libs/libwebkit2gtk-3.0.so.0
#18 0x0804853b in main ()
(gdb)
Comment 2 Carlos Garcia Campos 2012-02-20 10:34:35 PST
Created attachment 127832 [details]
Patch
Comment 3 Carlos Garcia Campos 2012-02-20 10:45:51 PST
Committed r108250: <http://trac.webkit.org/changeset/108250>