GNOME Bugzilla – Bug 727138
libsoup hangs in soup_body_output_stream_close_fn()
Last modified: 2014-11-02 16:29:41 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.
(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.
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?
(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.
Is there a branch that I could check out to have a look at your work and perhaps attempt to finish it?
Ah, most probably origin/wip/async-close ...
oops, yes, meant to mention that
fixed the test failures and committed this. let's hope it doesn't break anything else...