Skip to content

extensionDownloader: Replace deprecated Soup.SessionAsync

Michael Lass requested to merge michaellass/gnome-shell:soup-conn-timeout into master

Soup.SessionAsync by default sets timeout and idle_timeout to 0. This causes connections to hang around in state CLOSE_WAIT forever after the remote host has closed the connection.

To fix this, we could set timeout and idle_timeout manually. However, Soup.SessionAsync is marked as deprecated anyway and should be replaced by Soup.Session. Doing so also sets a default timeout of 60 seconds.

Fixes #2774 (closed)

Additional details:

  • There are a couple of subtle differences between Soup.Session and Soup.SessionAsync, for example how abort() and cancel_message() will be handled and in which contect the response is received. Search for "SessionAsync" at https://gjs-docs.gnome.org/soup24~2.70.0/soup.session to find them. I'm not familiar enough with gnome-shell's internals to say definitely if any of those could cause issues. However, I tested the update check for extensions by deliberately downgrading one of my extensions and it still seemed to work.
  • The fact that Soup.SessionAsync is deprecated is a bit hidden in the gjs documentation. However, it is clearly stated at https://developer.gnome.org/libsoup/stable/SoupSessionAsync.html.
  • We probably could drop the explicit setting of ssl_use_system_ca_file because it is true by default for Soup.Session. However, it does not hurt and makes sure that it's set correctly.

Merge request reports