Bug#798792: libhttp-proxy-perl: non-deterministic FTBFS: timing in 23connect.t

Niko Tyni ntyni at debian.org
Fri Oct 16 17:22:23 UTC 2015


Control: tag -1 patch

On Sat, Sep 12, 2015 at 09:42:16PM +0300, Niko Tyni wrote:
> Package: libhttp-proxy-perl
> Version: 0.304-1
> Severity: important
> Tags: upstream
> Forwarded: https://github.com/book/HTTP-Proxy/issues/7
> 
> There's apparently a timing problem in t/23connect.t
> that makes it fail non-determistically with
> 
>   t/23connect.t .. 
>   1..4
>   ok - The proxy accepts CONNECT requests
>   not ok - Read some data from the socket
>   not ok - CONNECTed to the TCP server and got the banner
>   
>   #   Failed test 'Read some data from the socket'
>   #   at t/23connect.t line 78.
>   
>   #   Failed test 'CONNECTed to the TCP server and got the banner'
>   #   at t/23connect.t line 79.
>   #          got: undef
>   #     expected: 'President_of_Earth Barbarella Professor_Ping Stomoxys Dildano
>   # '

As I wrote in the upstream bug, this is a problem with unwanted Net::HTTP
(as used by LWP::UserAgent) buffering.

It's possible for the LWP::UserAgent request() call to get both the
headers and (parts of) the body in the same read(2) call. When that
happens, Net::HTTP (as used by LWP::UserAgent) will buffer the body,
but the explicit read() call on the socket bypasses this buffering,
resulting in empty data.

The attached patch just marks the resulting test failures as TODO when
this happens by breaking encapsulation and peeking in the Net::HTTP
buffer. Note that this is a hack and not a proper fix, but I think it's
good enough for the Debian package.
-- 
Niko Tyni   ntyni at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Work-around-LWP-UserAgent-Net-HTTP-buffering.patch
Type: text/x-diff
Size: 1519 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20151016/8fff74db/attachment.patch>


More information about the pkg-perl-maintainers mailing list