From 9cad3fc6ed435af6ac7213539bcd3c0bd42606d2 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: May 20 2020 11:29:07 +0000 Subject: import spice-gtk-0.35-5.el7 --- diff --git a/SOURCES/0008-Detect-timeout-conditions-more-aggressively-on-Linux.patch b/SOURCES/0008-Detect-timeout-conditions-more-aggressively-on-Linux.patch new file mode 100644 index 0000000..f5b389b --- /dev/null +++ b/SOURCES/0008-Detect-timeout-conditions-more-aggressively-on-Linux.patch @@ -0,0 +1,87 @@ +From 9e9f2b81652d2ed551e9f890d27cf5a0da6ba5f6 Mon Sep 17 00:00:00 2001 +From: Jeremy White +Date: Tue, 30 Apr 2019 17:04:59 -0500 +Subject: [PATCH] Detect timeout conditions more aggressively on Linux + +This mitigates a fairly rare problem we see with our kiosk mode clients. +That is, normally if something goes wrong with a client connection +(e.g. the session is killed, or the server is restarted ), the kiosk will +exit on disconnect, and we get a chance to retry the connection, or +present the user with a 'server down' style message. + +But in the case of a serious network problem or a server hard power +cycle (i.e. no TCP FIN packets can flow), our end user behavior is not +ideal - the kiosk appears to hang solid, requiring a power cycle. + +That's because we've got the stock keepalive timeouts, or about 2 hours +and 11 minutes, before the client sees the disconnect. + +This change will cause the client to recognize the server has vanished +without a TCP FIN after 75 seconds. + +See this thread: + https://lists.freedesktop.org/archives/spice-devel/2017-March/036553.html + +As well as this bug: + https://bugzilla.redhat.com/show_bug.cgi?id=1436589 + +Signed-off-by: Jeremy White +(cherry picked from commit 677782fb6aa471d5e6d007744a5c6564b1f3021f) +--- + src/spice-session.c | 26 ++++++++++++++++++++++++++ + 1 file changed, 26 insertions(+) + +diff --git a/src/spice-session.c b/src/spice-session.c +index ee6e4cf..59c20c7 100644 +--- a/src/spice-session.c ++++ b/src/spice-session.c +@@ -17,6 +17,8 @@ + */ + #include "config.h" + ++/* include first, on Windows will override winsock definitions */ ++#include + #include + #include + #ifdef G_OS_UNIX +@@ -39,6 +41,13 @@ struct channel { + RingItem link; + }; + ++#if !defined(SOL_TCP) && defined(IPPROTO_TCP) ++#define SOL_TCP IPPROTO_TCP ++#endif ++#if !defined(TCP_KEEPIDLE) && defined(TCP_KEEPALIVE) && defined(__APPLE__) ++#define TCP_KEEPIDLE TCP_KEEPALIVE ++#endif ++ + #define IMAGES_CACHE_SIZE_DEFAULT (1024 * 1024 * 80) + #define MIN_GLZ_WINDOW_SIZE_DEFAULT (1024 * 1024 * 12) + #define MAX_GLZ_WINDOW_SIZE_DEFAULT MIN((LZ_MAX_WINDOW_SIZE * 4), 1024 * 1024 * 64) +@@ -2233,6 +2242,23 @@ GSocketConnection* spice_session_channel_open_host(SpiceSession *session, SpiceC + g_socket_set_timeout(socket, 0); + g_socket_set_blocking(socket, FALSE); + g_socket_set_keepalive(socket, TRUE); ++ ++ /* Make client timeouts a bit more responsive */ ++#if defined(_WIN32) ++ /* Windows does not support setting count */ ++ struct tcp_keepalive keepalive = { ++ TRUE, ++ 30 * 1000, ++ 5 * 1000 ++ }; ++ DWORD written; ++ WSAIoctl(g_socket_get_fd(socket), SIO_KEEPALIVE_VALS, &keepalive, sizeof(keepalive), ++ NULL, 0, &written, NULL, NULL); ++#elif defined(TCP_KEEPIDLE) && defined(TCP_KEEPINTVL) ++ g_socket_set_option(socket, SOL_TCP, TCP_KEEPIDLE, 30, NULL); ++ g_socket_set_option(socket, SOL_TCP, TCP_KEEPINTVL, 15, NULL); ++ g_socket_set_option(socket, SOL_TCP, TCP_KEEPCNT, 3, NULL); ++#endif + } + + g_clear_object(&open_host.client); +-- +2.21.0 + diff --git a/SOURCES/0009-Revert-channel-Abort-migration-in-delayed-unref.patch b/SOURCES/0009-Revert-channel-Abort-migration-in-delayed-unref.patch new file mode 100644 index 0000000..85fb60c --- /dev/null +++ b/SOURCES/0009-Revert-channel-Abort-migration-in-delayed-unref.patch @@ -0,0 +1,111 @@ +From e3f24cdc345f888730ea679e482d6217fb3d2b2a Mon Sep 17 00:00:00 2001 +From: Victor Toso +Date: Wed, 4 Sep 2019 12:37:34 +0200 +Subject: [PATCH] Revert "channel: Abort migration in delayed unref" + +This reverts commit 109e575 "channel: Abort migration in delayed +unref" in 2016-05-02 by Pavel Grunt + +This commit is being reverted because it calls +spice_session_abort_migration() on the SpiceSession for the target +host while the function should receive the SpiceSession for current +host. + +I can actually reproduce a bug where the password expires for the +current Spice session and the migration is going to fail because of +that. Before reverting this commit, remote-viewer would hang and the +following logs would occur: + +- Migration starts on channel-main + > ../src/channel-main.c:2174 migrate_channel_connect 1:0 + +- Using TLS + > ../src/spice-channel.c:1934 main-1:0: switching to tls + +- Following logs are related to failure to connect due Authentication + > ../src/spice-channel.c:2000 main-1:0: use mini header: 1 + > ../src/spice-channel.c:1274 main-1:0: link result: reply 7 + > ../src/spice-channel.c:2680 main-1:0: Coroutine exit main-1:0 + > ../src/spice-channel.c:2871 main-1:0: reset + +Remote-viewer would hang because we are in a state of migration and +SpiceMainChannel does not know that it failed because +spice_session_abort_migration() is being called on SpiceSession of +target host and no SpiceChannel::channel-event is being emitted. + +Reverting this patch does abort migration thanks to +SpiceChannel::channel-event being emitted and caught by +SpiceMainChannel at migrate_channel_event_cb() with the log: + + > ../src/channel-main.c:2247 main-1:0: error or unhandled channel event during migration: 23 + > ../src/channel-main.c:2373 main-1:0: migrate failed: some channels failed to connect + +Note that the reverted patch mentions the fix of bug [0] which is also +a virt-viewer with a hanging state. Looking back to the logs, the +interesting part around issues around usbredir, that is: + + > GSpice-DEBUG: channel-main.c:2236 migration: channel opened chan:0x29ddce0, left 6 + > GSpice-DEBUG: spice-channel.c:916 usbredir-9:0: Read error Error receiving data: Connection reset by peer + > GSpice-DEBUG: spice-channel.c:1210 usbredir-9:0: error, switching to protocol 1 (spice 0.4) + > GSpice-DEBUG: spice-channel.c:2433 usbredir-9:0: Coroutine exit usbredir-9:0 + > GSpice-DEBUG: spice-channel.c:2455 usbredir-9:0: Open coroutine starting 0x29e10d0 + > GSpice-DEBUG: spice-channel.c:2289 usbredir-9:0: Started background coroutine 0x29e0750 + > GSpice-DEBUG: spice-channel.c:916 usbredir-9:1: Read error Error receiving data: Connection reset by peer + > GSpice-DEBUG: spice-channel.c:1076 usbredir-9:1: incomplete auth reply (-104/4) + > GSpice-DEBUG: spice-channel.c:916 playback-5:0: Read error Error receiving data: Connection reset by peer + > GSpice-DEBUG: spice-channel.c:1076 playback-5:0: incomplete auth reply (-104/4) + > GSpice-DEBUG: spice-channel.c:916 display-2:0: Read error Error receiving data: Connection reset by peer + > GSpice-DEBUG: spice-channel.c:1076 display-2:0: incomplete auth reply (-104/4) + > GSpice-DEBUG: spice-session.c:1775 connecting 0x7f12bffffa50... + > GSpice-DEBUG: spice-session.c:1850 open host lab.test.me:5900 + > GSpice-DEBUG: channel-main.c:2241 error or unhandled channel event during migration: 22 + > GSpice-DEBUG: spice-session.c:1665 session: disconnecting 0 + > GSpice-DEBUG: spice-channel.c:2160 usbredir-9:1: channel got error + > GSpice-DEBUG: spice-channel.c:2433 usbredir-9:1: Coroutine exit usbredir-9:1 + > GSpice-DEBUG: channel-main.c:2241 error or unhandled channel event during migration: 22 + +So, the expected behavior was happening on error, which is +channel-main aborting the migration due SpiceChannel::channel-event +being emitted with some failure. + +Also note that, with this commit reverted, I don't experience any +hanging after migration is aborted. Likely the original bug was fixed. + +[0] https://bugzilla.redhat.com/show_bug.cgi?id=1318574 + +Related: https://bugzilla.redhat.com/show_bug.cgi?id=1695618 + +Signed-off-by: Victor Toso +--- + src/spice-channel.c | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/src/spice-channel.c b/src/spice-channel.c +index 2eec4e0..9128e36 100644 +--- a/src/spice-channel.c ++++ b/src/spice-channel.c +@@ -2410,7 +2410,6 @@ static gboolean spice_channel_delayed_unref(gpointer data) + SpiceChannel *channel = SPICE_CHANNEL(data); + SpiceChannelPrivate *c = channel->priv; + gboolean was_ready = c->state == SPICE_CHANNEL_STATE_READY; +- SpiceSession *session; + + CHANNEL_DEBUG(channel, "Delayed unref channel %p", channel); + +@@ -2418,13 +2417,6 @@ static gboolean spice_channel_delayed_unref(gpointer data) + + c->state = SPICE_CHANNEL_STATE_UNCONNECTED; + +- session = spice_channel_get_session(channel); +- if (session && spice_session_is_for_migration(session)) { +- /* error during migration - abort migration */ +- spice_session_abort_migration(session); +- return FALSE; +- } +- + if (c->event != SPICE_CHANNEL_NONE) { + g_coroutine_signal_emit(channel, signals[SPICE_CHANNEL_EVENT], 0, c->event); + c->event = SPICE_CHANNEL_NONE; +-- +2.21.0 + diff --git a/SPECS/spice-gtk.spec b/SPECS/spice-gtk.spec index 28dd743..c0f8c16 100644 --- a/SPECS/spice-gtk.spec +++ b/SPECS/spice-gtk.spec @@ -4,7 +4,7 @@ Name: spice-gtk Version: 0.35 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A GTK+ widget for SPICE clients Group: System Environment/Libraries @@ -19,6 +19,8 @@ Patch0004: 0004-spice-channel-Properly-error-out-if-reconnect-fails.patch Patch0005: 0005-usb-device-manager-Handle-connectionless-channel.patch Patch0006: 0006-channel-usbredir-Add-FIXMEs-on-channel-reset-issues.patch Patch0007: 0007-channel-usbredir-Chain-up-with-parent-s-channel-rese.patch +Patch0008: 0008-Detect-timeout-conditions-more-aggressively-on-Linux.patch +Patch0009: 0009-Revert-channel-Abort-migration-in-delayed-unref.patch BuildRequires: intltool BuildRequires: usbredir-devel >= 0.6-8 @@ -127,6 +129,8 @@ spicy-screenshot is a tool to capture screen-shots of a SPICE desktop. %patch0005 -p1 %patch0006 -p1 %patch0007 -p1 +%patch0008 -p1 +%patch0009 -p1 %build %configure \ @@ -199,6 +203,12 @@ rm -f %{buildroot}%{_libdir}/*.la %{_bindir}/spicy-stats %changelog +* Tue Oct 15 2019 Victor Toso - 0.35-5 +- Keepalive fix + Resolves: rhbz#1719736 +- Fix hang on migration after password expired + Resolves: rhbz#1761776 + * Fri Mar 15 2019 Victor Toso - 0.35-4 - Fix bad channel-reset on usbredir Resolves: rhbz#1625550