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 727138 - libsoup hangs in soup_body_output_stream_close_fn()
libsoup hangs in soup_body_output_stream_close_fn()
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: HTTP Transport
2.42.x
Other Linux
: Normal major
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2014-03-27 07:49 UTC by Sven Neumann
Modified: 2014-11-02 16:29 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sven Neumann 2014-03-27 07:49:48 UTC
We are occasionally seeing processes which are stuck in the main-loop because soup_body_output_stream_close_fn() apparently does a blocking write to the stream that it is supposed to close:

 0xb6bb9c70  __poll() from /lib/libc.so.6
 0xb6d93678  g_poll() from /usr/lib/libglib-2.0.so.0
 0xb6f059dc  g_socket_condition_timed_wait() from /usr/lib/libgio-2.0.so.0
 0xb6f05cbd  g_socket_condition_wait() from /usr/lib/libgio-2.0.so.0
 0xb6f06102  g_socket_send_with_blocking() from /usr/lib/libgio-2.0.so.0
 0xb6f0f699  g_socket_output_stream_write() from /usr/lib/libgio-2.0.so.0
 0xb6ef9dba  g_output_stream_write() from /usr/lib/libgio-2.0.so.0
 0xb6efb84f  g_pollable_stream_write() from /usr/lib/libgio-2.0.so.0
 0xb768ee43  soup_body_output_stream_write_chunked() from /usr/lib/libsoup-2.4.so.1
 0xb768f488  soup_body_output_stream_close_fn() from /usr/lib/libsoup-2.4.so.1
 0xb6ef89bd  _g_output_stream_close_internal() from /usr/lib/libgio-2.0.so.0
 0xb6efa35c  g_output_stream_close() from /usr/lib/libgio-2.0.so.0
 0xb76abdfb  io_run_until() from /usr/lib/libsoup-2.4.so.1
 0xb76ac928  io_run() from /usr/lib/libsoup-2.4.so.1
 0xb76aae94  message_source_dispatch() from /usr/lib/libsoup-2.4.so.1
 0xb6d816b1  g_main_context_dispatch() from /usr/lib/libglib-2.0.so.0
 0xb6d8197f  g_main_context_iterate.isra.23() from /usr/lib/libglib-2.0.so.0
 0xb6d81f7b  g_main_loop_run() from /usr/lib/libglib-2.0.so.0

Unfortunately I can not give you instructions on how to reproduce this.
Comment 1 Dan Winship 2014-03-27 13:47:31 UTC
(In reply to comment #0)
> Unfortunately I can not give you instructions on how to reproduce this.

> 0xb768ee43  soup_body_output_stream_write_chunked() from
/usr/lib/libsoup-2.4.so.1

When sending a chunked message body, close() writes the final 0-length chunk ("0\r\n\r\n") that marks the stream as complete. So libsoup needs to be fixed to do an async close here.
Comment 2 Sven Neumann 2014-04-16 15:22:13 UTC
I found some time today to look into this again and started an attempt to fix the problem. But to be honest I got lost in the libsoup code and I am not sure how to approach the problem. Perhaps you could give me some more hints?
Comment 3 Dan Winship 2014-06-09 13:00:20 UTC
(In reply to comment #2)
> I found some time today to look into this again and started an attempt to fix
> the problem. But to be honest I got lost in the libsoup code and I am not sure
> how to approach the problem. Perhaps you could give me some more hints?

Sorry I never got back to you... been busy...

I started working on this yesterday and implemented the basic idea (it's weird because we have to make an async call, while everything else in soup-message-io is based on non-blocking I/O and polling). It doesn't quite work yet. Feel free to poke at it if you want, or I'll get back to it later.
Comment 4 Sven Neumann 2014-06-18 12:50:24 UTC
Is there a branch that I could check out to have a look at your work and perhaps attempt to finish it?
Comment 5 Sven Neumann 2014-06-18 12:52:37 UTC
Ah, most probably origin/wip/async-close ...
Comment 6 Dan Winship 2014-06-18 13:22:40 UTC
oops, yes, meant to mention that
Comment 7 Dan Winship 2014-11-02 16:29:41 UTC
fixed the test failures and committed this. let's hope it doesn't
break anything else...