[Spice-devel] [PATCH vdagent-win 1/1] vdservice: fix vdagent first launch (during startup) failure handling rhbz#750037

Uri Lublin uril at redhat.com
Tue Dec 27 02:10:29 PST 2011

On 12/26/2011 12:58 PM, Arnon Gilboa wrote:
> In case of agent launch failure: if connection state is not active(*), wait for
> agent launch on the next session connection. Otherwise, the service is stopped.
> (*) The failure was due to system startup timings and logon settings, causing
> the first agent instance lifetime (before session connect) to be too short to
> connect the service.


Although Arnon explained it above, I'd like to clarify (please correct
me if I'm wrong).
This case only happens on system startup.
On system startup, there is a default "startup" session, that is later
replaced with another session. Sometimes the switch between those
sessions are "too fast" such that the first session is terminated before
connecting to the service.
In such a case the service had exited.
When the next session starts we get an event and can retry.

This fix makes vdservice wait for the next session to start, instead of
Service exits only if a user is already logged-in (active state).

> @@ -952,7 +975,9 @@ bool VDService::restart_agent(bool normal_restart)
>          }
>          _last_agent_restart_time = time;
>          ret = true;
> -        read_pipe();
> +        if (_vdi_port) {
> +            read_pipe();
> +        }
>      }
>      MUTEX_UNLOCK(_agent_mutex);
>      return ret;

For cleanliness, I'd add setting _vdi_port to NULL in init_vdi_port()
upon failure.

More information about the Spice-devel mailing list