Deadlock between g_module_open() and dlopen() when called from a constructor
Starting Evolution under valgrind --tool=helgrind --num-callers=40 prints the text below. My interpretation is, that it calls g_proxy_resolver_get_default (where the incorrect order was observed) and g_module_open() and just because these functions are called, there is a deadlock.
I use glib-2.56.1 and libproxy-0.4.15.
Is the problem to be resolved in glib, Evolution or libproxy?
If necessary I will provide trace with more function by increasing --num-callers.
Thread #1: lock order "0x24AB2A90 before 0x4225968" violated
Observed (incorrect) order is: acquisition of lock at 0x4225968
at 0x4C313F0: mutex_lock_WRK (hg_intercepts.c:909)
by 0x4C3527C: pthread_mutex_lock (hg_intercepts.c:925)
by 0x40127B1: _dl_open (dl-open.c:542)
by 0x178E1EF5: dlopen_doit (dlopen.c:66)
by 0x146B5D0B: _dl_catch_exception (dl-error-skeleton.c:196)
by 0x146B5D7E: _dl_catch_error (dl-error-skeleton.c:215)
by 0x178E2534: _dlerror_run (dlerror.c:162)
by 0x178E1F90: dlopen@@GLIBC_2.2.5 (dlopen.c:87)
by 0x3354879C: libmodman::module_manager::load_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool) (module_manager.cpp:251)
by 0x335493DB: libmodman::module_manager::load_dir(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool) (module_manager.cpp:328)
by 0x33537718: libproxy::proxy_factory::proxy_factory() (proxy.cpp:165)
by 0x33537BBA: px_proxy_factory_new (proxy.cpp:449)
by 0x333294A1: g_libproxy_resolver_init (glibproxyresolver.c:79)
by 0xA82CFA4: g_type_create_instance (gtype.c:1866)
by 0xA80E777: g_object_new_internal (gobject.c:1799)
by 0xA80FE14: g_object_new_with_properties (gobject.c:1967)
by 0xA810820: g_object_new (gobject.c:1639)
by 0xA4C68C0: try_implementation (giomodule.c:815)
by 0xA4C69EF: _g_io_module_get_default (giomodule.c:914)
by 0x5136C5E: camel_service_init (camel-service.c:1077)
by 0xA82CF67: g_type_create_instance (gtype.c:1860)
by 0xA80E777: g_object_new_internal (gobject.c:1799)
by 0xA8104AF: g_object_new_valist (gobject.c:2122)
by 0xA4C3275: g_initable_new_valist (ginitable.c:244)
by 0xA4C332B: g_initable_new (ginitable.c:162)
by 0x513B83C: session_add_service (camel-session.c:448)
by 0x29B3810F: mail_session_add_service (e-mail-session.c:1186)
by 0x2A62BFD5: mail_ui_session_add_service (e-mail-ui-session.c:516)
by 0x513B457: camel_session_add_service (camel-session.c:922)
by 0x29B3861D: mail_session_add_from_source (e-mail-session.c:464)
by 0x29B391F0: mail_session_constructed (e-mail-session.c:1052)
by 0xA80E91F: g_object_new_internal (gobject.c:1839)
by 0xA8104AF: g_object_new_valist (gobject.c:2122)
by 0xA81080B: g_object_new (gobject.c:1642)
by 0x2A62CBCA: e_mail_ui_session_new (e-mail-ui-session.c:1015)
by 0x2A5DA8FA: mail_backend_constructed (e-mail-backend.c:1229)
by 0x2F5925B1: mail_shell_backend_constructed (e-mail-shell-backend.c:827)
by 0xA80ED74: g_object_new_internal (gobject.c:1771)
by 0xA8104AF: g_object_new_valist (gobject.c:2122)
by 0xA81080B: g_object_new (gobject.c:1642)
followed by a later acquisition of lock at 0x24AB2A90
at 0x4C313F0: mutex_lock_WRK (hg_intercepts.c:909)
by 0x4C3527C: pthread_mutex_lock (hg_intercepts.c:925)
by 0x99B5532: g_module_open (gmodule.c:500)
by 0x3398DA62: _nm_utils_init (nm-utils.c:248)
by 0x400EE49: call_init.part.0 (dl-init.c:72)
by 0x400EF55: _dl_init (dl-init.c:118)
by 0x4012F62: dl_open_worker (dl-open.c:511)
by 0x146B5D0B: _dl_catch_exception (dl-error-skeleton.c:196)
by 0x4012829: _dl_open (dl-open.c:594)
by 0x178E1EF5: dlopen_doit (dlopen.c:66)
by 0x146B5D0B: _dl_catch_exception (dl-error-skeleton.c:196)
by 0x146B5D7E: _dl_catch_error (dl-error-skeleton.c:215)
by 0x178E2534: _dlerror_run (dlerror.c:162)
by 0x178E1F90: dlopen@@GLIBC_2.2.5 (dlopen.c:87)
by 0x3354879C: libmodman::module_manager::load_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool) (module_manager.cpp:251)
by 0x335493DB: libmodman::module_manager::load_dir(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool) (module_manager.cpp:328)
by 0x33537718: libproxy::proxy_factory::proxy_factory() (proxy.cpp:165)
by 0x33537BBA: px_proxy_factory_new (proxy.cpp:449)
by 0x333294A1: g_libproxy_resolver_init (glibproxyresolver.c:79)
by 0xA82CFA4: g_type_create_instance (gtype.c:1866)
by 0xA80E777: g_object_new_internal (gobject.c:1799)
by 0xA80FE14: g_object_new_with_properties (gobject.c:1967)
by 0xA810820: g_object_new (gobject.c:1639)
by 0xA4C68C0: try_implementation (giomodule.c:815)
by 0xA4C69EF: _g_io_module_get_default (giomodule.c:914)
by 0x5136C5E: camel_service_init (camel-service.c:1077)
by 0xA82CF67: g_type_create_instance (gtype.c:1860)
by 0xA80E777: g_object_new_internal (gobject.c:1799)
by 0xA8104AF: g_object_new_valist (gobject.c:2122)
by 0xA4C3275: g_initable_new_valist (ginitable.c:244)
by 0xA4C332B: g_initable_new (ginitable.c:162)
by 0x513B83C: session_add_service (camel-session.c:448)
by 0x29B3810F: mail_session_add_service (e-mail-session.c:1186)
by 0x2A62BFD5: mail_ui_session_add_service (e-mail-ui-session.c:516)
by 0x513B457: camel_session_add_service (camel-session.c:922)
by 0x29B3861D: mail_session_add_from_source (e-mail-session.c:464)
by 0x29B391F0: mail_session_constructed (e-mail-session.c:1052)
by 0xA80E91F: g_object_new_internal (gobject.c:1839)
by 0xA8104AF: g_object_new_valist (gobject.c:2122)
by 0xA81080B: g_object_new (gobject.c:1642)
Required order was established by acquisition of lock at 0x24AB2A90
at 0x4C313F0: mutex_lock_WRK (hg_intercepts.c:909)
by 0x4C3527C: pthread_mutex_lock (hg_intercepts.c:925)
by 0x99B5532: g_module_open (gmodule.c:500)
by 0x74D7D58: _gtk_module_has_mixed_deps (gtkmodules.c:590)
by 0x74B1321: pre_parse_hook (gtkmain.c:654)
by 0xAAA26D4: g_option_context_parse (goption.c:1937)
by 0xF4554B0: gtk_clutter_init_with_args (gtk-clutter-util.c:294)
by 0x40443E: main (main.c:471)
followed by a later acquisition of lock at 0x4225968
at 0x4C313F0: mutex_lock_WRK (hg_intercepts.c:909)
by 0x4C3527C: pthread_mutex_lock (hg_intercepts.c:925)
by 0x40127B1: _dl_open (dl-open.c:542)
by 0x178E1F10: dlopen_doit (dlopen.c:66)
by 0x146B5D0B: _dl_catch_exception (dl-error-skeleton.c:196)
by 0x146B5D7E: _dl_catch_error (dl-error-skeleton.c:215)
by 0x178E2534: _dlerror_run (dlerror.c:162)
by 0x178E1F90: dlopen@@GLIBC_2.2.5 (dlopen.c:87)
by 0x99B59CB: g_module_open (gmodule-dl.c:125)
by 0x74D7D58: _gtk_module_has_mixed_deps (gtkmodules.c:590)
by 0x74B1321: pre_parse_hook (gtkmain.c:654)
by 0xAAA26D4: g_option_context_parse (goption.c:1937)
by 0xF4554B0: gtk_clutter_init_with_args (gtk-clutter-util.c:294)
by 0x40443E: main (main.c:471)
Lock at 0x24AB2A90 was first observed
at 0x4C35259: pthread_mutex_init (hg_intercepts.c:787)
by 0xAADA1AC: g_rec_mutex_impl_new (gthread-posix.c:282)
by 0xAADA267: g_rec_mutex_lock (gthread-posix.c:302)
by 0x99B5532: g_module_open (gmodule.c:500)
by 0x74D7D58: _gtk_module_has_mixed_deps (gtkmodules.c:590)
by 0x74B1321: pre_parse_hook (gtkmain.c:654)
by 0xAAA26D4: g_option_context_parse (goption.c:1937)
by 0xF4554B0: gtk_clutter_init_with_args (gtk-clutter-util.c:294)
by 0x40443E: main (main.c:471)
Address 0x24ab2a90 is 0 bytes inside a block of size 40 alloc'd
at 0x4C2E18B: malloc (vg_replace_malloc.c:299)
by 0xAADA17F: g_rec_mutex_impl_new (gthread-posix.c:276)
by 0xAADA267: g_rec_mutex_lock (gthread-posix.c:302)
by 0x99B5532: g_module_open (gmodule.c:500)
by 0x74D7D58: _gtk_module_has_mixed_deps (gtkmodules.c:590)
by 0x74B1321: pre_parse_hook (gtkmain.c:654)
by 0xAAA26D4: g_option_context_parse (goption.c:1937)
by 0xF4554B0: gtk_clutter_init_with_args (gtk-clutter-util.c:294)
by 0x40443E: main (main.c:471)
Block was alloc'd by thread #1
Lock at 0x4225968 was first observed
at 0x4C313F0: mutex_lock_WRK (hg_intercepts.c:909)
by 0x4C3527C: pthread_mutex_lock (hg_intercepts.c:925)
by 0x40127B1: _dl_open (dl-open.c:542)
by 0x178E1F10: dlopen_doit (dlopen.c:66)
by 0x146B5D0B: _dl_catch_exception (dl-error-skeleton.c:196)
by 0x146B5D7E: _dl_catch_error (dl-error-skeleton.c:215)
by 0x178E2534: _dlerror_run (dlerror.c:162)
by 0x178E1F90: dlopen@@GLIBC_2.2.5 (dlopen.c:87)
by 0xF1BCB37: bmalloc::Environment::computeIsDebugHeapEnabled() (Environment.cpp:99)
by 0xF1BCB98: bmalloc::Environment::Environment(std::lock_guard<bmalloc::StaticMutex>&) (Environment.cpp:111)
by 0xF1B58B4: bmalloc::PerProcess<bmalloc::Environment>::getSlowCase() (PerProcess.h:81)
by 0xF1B5E42: bmalloc::Heap::Heap(bmalloc::HeapKind, std::lock_guard<bmalloc::StaticMutex>&) (PerProcess.h:65)
by 0xF1B3E32: bmalloc::PerProcess<bmalloc::PerHeapKind<bmalloc::Heap> >::getSlowCase() (PerHeapKind.h:43)
by 0xF1B3B03: bmalloc::Cache::Cache(bmalloc::HeapKind) (PerProcess.h:65)
by 0xF1B3EF5: bmalloc::PerThread<bmalloc::PerHeapKind<bmalloc::Cache> >::getSlowCase() (PerHeapKind.h:43)
by 0xF1B3BAE: bmalloc::Cache::allocateSlowCaseNullCache(bmalloc::HeapKind, unsigned long) (Cache.cpp:58)
by 0xF19A5D5: WTF::StringImpl::createFromLiteral(char const*, unsigned int) (StringImpl.h:161)
by 0xF19A650: WTF::StringImpl::createFromLiteral(char const*) (StringImpl.cpp:158)
by 0xF1A6321: WTF::String::String(WTF::ASCIILiteral) (WTFString.cpp:83)
by 0xC0A2806: _GLOBAL__sub_I_PasteboardHelper.cpp (PasteboardHelper.cpp:43)
by 0x400EE49: call_init.part.0 (dl-init.c:72)
by 0x400EF55: _dl_init (dl-init.c:118)
by 0x4001069: ??? (in /lib64/ld-2.27.so)
Address 0x4225968 is 2312 bytes inside data symbol "_rtld_local"
Edited by Philip Withnall