[Spice-devel] [PATCH spice-server 4/4] tests: Add a test to check tight loop during ack waiting

Christophe Fergeau cfergeau at redhat.com
Mon Sep 18 16:07:06 UTC 2017


On Mon, Sep 18, 2017 at 11:40:18AM -0400, Frediano Ziglio wrote:
> > 
> > On Mon, Sep 18, 2017 at 11:28:30AM +0100, Frediano Ziglio wrote:
> > > +// timer waiting we get data again
> > > +static void timer_wakeup(void *opaque)
> > > +{
> > > +    SpiceCoreInterface *core = opaque;
> > > +
> > > +    // check we are receiving data again
> > > +    size_t got_data = 0;
> > > +    ssize_t len;
> > > +    alarm(1);
> > > +    char buffer[256];
> > > +    while ((len=recv(client_socket, buffer, sizeof(buffer), 0)) > 0)
> > > +        got_data += len;
> > > +    alarm(0);
> > > +
> > > +    g_assert_cmpint(got_data, >, 0);
> > > +
> > > +    core->timer_remove(waked_up_timer);
> > > +
> > > +    basic_event_loop_quit();
> > > +}
> > > +
> > > +// timeout, now we can send the ack
> > > +// if we arrive here it means we didn't reveice much watch events
> > 
> > "receive"
> 
> yes
> 
> > s/much/any/ ?
> >
> 
> maybe "too much" ?
> one surely is going to receive, maybe 2/3.

Ah ok, so if we arrive here, the test is working fine? "too many watch
events" then.

> > 
> > Did not carefully review this, but test is running fine on my system.
> > 
> 
> Without the fix I'm getting (which is correct) a
> 
> $ ./test-channel 
> /server/channel: main_channel_link: add main channel client
> 
> (./test-channel:30697): Spice-ERROR **: test-channel.c:166:watch_func_inject: Watch called too many time
> Trace/breakpoint trap (core dumped)

Oh, sorry, I meant with the patch applied, ie "looks good to me", and
forgot to append the
Acked-by: Christophe Fergeau <cfergeau at redhat.com>


> 
> > Christophe
> > 
> 
> Merged your patch.
> 
> Frediano


More information about the Spice-devel mailing list