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 796031 - Deadlock with libsoup
Deadlock with libsoup
Status: RESOLVED DUPLICATE of bug 674885
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2018-05-11 14:23 UTC by Mathieu Bridon
Modified: 2018-05-16 09:33 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mathieu Bridon 2018-05-11 14:23:03 UTC
`flatpak-builder` very often stays stuck while downloading the sources for the modules it has to build. The only way to progress is to kill it with ctrl+c then restart it.

Stracing the process gave:

```
$ strace -p 19081 -f
strace: Process 19081 attached with 3 threads
[pid 19085] futex(0x564702991a90, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
[pid 19083] restart_syscall(<... resuming interrupted restart_syscall ...> <unfinished ...>
[pid 19081] futex(0x7fb22cd7af78, FUTEX_WAIT_PRIVATE, 160, NULL
```

With gdb, I got the following backtrace:

```

Thread 3 (Thread 0x7fb215151700 (LWP 19085))

  • #0 __lll_lock_wait
    at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S line 135
  • #1 __GI___pthread_mutex_lock
    at ../nptl/pthread_mutex_lock.c line 113
  • #2 g_rec_mutex_lock
    at gthread-posix.c line 308
  • #3 g_type_add_interface_static
    at gtype.c line 2842
  • #4 g_socket_get_type
    at gsocket.c line 278
  • #5 ensure_required_types
    at gdbusprivate.c line 257
  • #6 _g_dbus_initialize
    at gdbusprivate.c line 1950
  • #7 g_bus_get_sync
    at gdbusconnection.c line 7271
  • #8 dconf_gdbus_get_bus_in_worker
    at ../gdbus/dconf-gdbus-thread.c line 189
  • #9 dconf_gdbus_method_call
    at ../gdbus/dconf-gdbus-thread.c line 247
  • #10 g_idle_dispatch
    at gmain.c line 5535
  • #11 g_main_dispatch
    at gmain.c line 3177
  • #12 g_main_context_dispatch
    at gmain.c line 3830
  • #13 g_main_context_iterate
    at gmain.c line 3903
  • #14 g_main_context_iteration
    at gmain.c line 3964
  • #15 dconf_gdbus_worker_thread
    at ../gdbus/dconf-gdbus-thread.c line 82
  • #16 g_thread_proxy
    at gthread.c line 784
  • #17 start_thread
    at pthread_create.c line 463
  • #18 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 95

Thread 1 (Thread 0x7fb22e172940 (LWP 19081))

  • #0 syscall
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S line 38
  • #1 g_cond_wait
    at gthread-posix.c line 1402
  • #2 g_once_init_enter
    at gthread.c line 665
  • #3 g_socket_get_type
    at gsocket.c line 278
  • #4 soup_socket_class_init
    at soup-socket.c line 546
  • #5 soup_socket_class_intern_init
    at soup-socket.c line 102
  • #6 type_class_init_Wm
    at gtype.c line 2232
  • #7 g_type_class_ref
    at gtype.c line 2947
  • #8 g_object_new_valist
    at gobject.c line 2074
  • #9 soup_socket_new
    at soup-socket.c line 824
  • #10 soup_connection_connect_sync
    at soup-connection.c line 453
  • #11 get_connection
    at soup-session.c line 1956
  • #12 soup_session_process_queue_item
    at soup-session.c line 1977
  • #13 soup_session_send
    at soup-session.c line 4429
  • #14 builder_download_uri
    at src/builder-utils.c line 1943
  • #15 builder_context_download_uri
    at src/builder-context.c line 495
  • #16 builder_source_archive_download
    at src/builder-source-archive.c line 384
  • #17 builder_module_download_sources
    at src/builder-module.c line 1024
  • #18 builder_manifest_download
    at src/builder-manifest.c line 1814
  • #19 main
    at /usr/include/glib-2.0/glib/glib-autocleanups.h line 28
  • #20 __libc_start_main
    at ../csu/libc-start.c line 308
  • #21 _start
    at /usr/include/sys/stat.h line 451

Alex said this would be a glib/libsoup deadlock and asked me to report the issue here.

I can reproduce the problem very easily, it generally takes me 2 to 5 attempts before flatpak-builder finally succeeds downloading.

This is with:

libsoup-2.62.1-1.fc28.x86_64
glib2-2.56.1-1.fc28.x86_64
Comment 1 Philip Withnall 2018-05-16 09:33:47 UTC
This is bug #674885, which has been worked around in the case that GDBus initialises types early — but it looks like the case here is that libsoup is initialising types early.

For the moment, I suggest flatpak-builder is modified to use the workaround described in https://bugzilla.gnome.org/show_bug.cgi?id=674885#c87. i.e. Add those g_type_ensure() calls early on in main() in flatpak-builder.

Eventually, bug #674885 will be fixed properly and the workaround can be removed from flatpak-builder. The workaround will be harmless once bug #674885 is actually fixed properly.

*** This bug has been marked as a duplicate of bug 674885 ***