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 707711 - Downloading large files blocks main loop
Downloading large files blocks main loop
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: API
2.42.x
Other Linux
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
: 721723 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-09-08 10:59 UTC by Simonas Kazlauskas
Modified: 2014-01-07 20:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The reduced testcase (1.80 KB, text/plain)
2013-09-08 11:00 UTC, Simonas Kazlauskas
Details

Description Simonas Kazlauskas 2013-09-08 10:59:45 UTC
I've been downloading images with libsoup, its introspection for Python and asynchronous queue_message API. Somewhere along the road I noticed that UI freezes during the download of larger image.

Apparently soup's asynchronous API (queue_message) blocks the main loop (at least in Python) for most of the time required to download whole image.

Attached is minimal test case which can be run with both Python 2 and 3.
Comment 1 Simonas Kazlauskas 2013-09-08 11:00:33 UTC
Created attachment 254390 [details]
The reduced testcase
Comment 2 Dan Winship 2013-09-08 15:06:26 UTC
Huh. Weird that this never showed up before.

Basically, the I/O code assumes that as long as it doesn't get an EWOULDBLOCK, that it should just keep reading. So, if the server returns data fast enough, libsoup will never return to the main loop.
Comment 3 Simonas Kazlauskas 2013-09-24 15:33:31 UTC
Should this still be unconfirmed?

Also are there any viable workarounds which doesn't use soup_session_send_finish (not introspectable)?
Comment 4 Dan Winship 2013-09-24 15:46:02 UTC
Most GNOME modules don't make use of the distinction between UNCONFIRMED and NEW, so UNCONFIRMED doesn't mean "unconfirmed".

> Also are there any viable workarounds which doesn't use
> soup_session_send_finish (not introspectable)?

That function is completely unrelated.

There's no good workaround. The bad workaround is to connect to "read-chunk", and call soup_session_pause_message() from there, and queue an idle handler to call soup_session_unpause_message().
Comment 5 Dan Winship 2013-09-28 19:14:11 UTC
ugh, no, this is just a stupid bug in the new plain SoupSession; so the workaround is to use Soup.SessionAsync instead, and just make sure to set all the defaults (ssl, proxy resolver, etc) to good values yourself.
Comment 6 Dan Winship 2013-09-28 20:22:16 UTC
fixed in git master, and will eventually be in 2.44.1
Comment 7 Dan Winship 2014-01-07 20:20:45 UTC
*** Bug 721723 has been marked as a duplicate of this bug. ***