[Libosinfo] [libosinfo PATCH 1/2] tests: Avoid re-using the curl handler on URIs tests

Daniel P. Berrangé berrange at redhat.com
Mon Feb 4 13:50:28 UTC 2019


On Mon, Feb 04, 2019 at 02:44:25PM +0100, Fabiano Fidêncio wrote:
> On CentOS, we've hit an issue that when a curl handler is re-used we end
> up receiving malfunctioning responses from NetBSD CDN.
> 
> Dan investigated the issue and suggested that the problem may be a
> timing issue happening only in certain versions of libcurl (as it only
> hit us when testing on el7).

The HTTP spec says

  "A response to a HEAD method should not have a body. If so, it
   must be ignored."

the problem is that libcurl in centos7 at least is not ignoring
the body....  Sometimes it closes the keepalive connetion so this
doesn't matter, but other times it gives us back the body that it
should be ignoring.

Anyway, closing the connection is a robust solution

> 
> The main difference of a working and a non-working system is that in the
> former when trying to re-use connection, we always get it's dead, and a new
> connection is opened; while in the latter sometimes the connection is
> detected as dead (but sometimes not), causing then the issue described
> above when the connection is not detected as dead.
> 
> In order to work the issue around, let's no re-use the curl handler but
> always open a new one for each of the URIs.
> 
> Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
> ---
>  tests/test-imageuris.c | 37 ++++++++++++++++++-------------------
>  tests/test-mediauris.c | 37 ++++++++++++++++++-------------------
>  tests/test-treeuris.c  | 38 ++++++++++++++++++--------------------
>  3 files changed, 54 insertions(+), 58 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the Libosinfo mailing list