GNOME Bugzilla – Bug 707711
Downloading large files blocks main loop
Last modified: 2014-01-07 20:20: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.
Created attachment 254390 [details] The reduced testcase
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.
Should this still be unconfirmed? Also are there any viable workarounds which doesn't use soup_session_send_finish (not introspectable)?
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().
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.
fixed in git master, and will eventually be in 2.44.1
*** Bug 721723 has been marked as a duplicate of this bug. ***