[Spice-devel] [PATCH spice-gtk] channel: fix critical warning on migration

Marc-André Lureau mlureau at redhat.com
Thu Nov 14 05:17:06 PST 2013



----- Original Message -----
> On Wed, Nov 13, 2013 at 10:13:10PM +0100, Marc-André Lureau wrote:
> > When migrating a channel, all channels are disconnected during reset()
> > after MAIN_MIGRATED_END. The channel swap on destination will happen
> > only after MAIN_INIT is completed. During that time, the channel
> > coroutine can be waiting for socket events, and will have its socket
> > closed and cleared.
> > 
> > Add a missing channel state check to fix a warning. (fwiw, the coroutine
> > is then blocked in wait_migration() until migration is fully completed)
> > 
> > (remote-viewer:7061): GLib-GIO-CRITICAL **: g_socket_condition_check:
> > assertion `G_IS_SOCKET (socket)' failed
> > ---
> >  gtk/spice-channel.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
> > index 41d5eab..9eb7ce5 100644
> > --- a/gtk/spice-channel.c
> > +++ b/gtk/spice-channel.c
> > @@ -2106,6 +2106,9 @@ static gboolean spice_channel_iterate(SpiceChannel
> > *channel)
> >      SPICE_CHANNEL_GET_CLASS(channel)->iterate_write(channel);
> >      SPICE_CHANNEL_GET_CLASS(channel)->iterate_read(channel);
> >  
> > +    if (c->state == SPICE_CHANNEL_STATE_MIGRATING)
> > +        return TRUE;
> > +
> 
> spice_channel_iterate_read() which may be called right before the check you
> add is calling
> g_coroutine_socket_wait(&c->coroutine, c->sock, G_IO_IN);
> Is it ok to do in the situation you describe?

It's ok, since it should never happen.

The channel coroutine can't be in the iterate_write() during the migration. Since there is no yielding between write and read state, it _must_ be waiting in read() or waiting in the wait_migration condition.
 
If it happens, I would like to see a warning to prove myself wrong, or track a possible bug.

> 
> Christophe
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list