Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test fails randomly #31

Closed
guimard opened this issue Sep 24, 2018 · 4 comments
Closed

Test fails randomly #31

guimard opened this issue Sep 24, 2018 · 4 comments

Comments

@guimard
Copy link

guimard commented Sep 24, 2018

Hello,
test t/63 fails randomly with this output:

t/62-plack-runner.t ....... 
1..6
ok 1 - feersum runner connected
ok 2 - script http success
ok 3
ok 4 - plackup runner connected
ok 5 - script http success
ok 6
ok

#   Failed test at t/63-plack-apps.t line 84.
#          got: '599'
#     expected: '200'

#   Failed test 'found static line (cascade)'
#   at t/63-plack-apps.t line 85.
#                   'Could not read from socket: 'Connection reset by peer'
# '
#     doesn't match '(?^m:^\#\ IS\ THIS\ FILE\ STATICALLY\ SERVED\?$)'
# Looks like you failed 2 tests of 6.
t/63-plack-apps.t ......... 
1..6
ok 1
ok 2 - found static line
ok 3
ok 4 - found static line (cascade)
not ok 5
not ok 6 - found static line (cascade)
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/6 subtests 

See Debian report

@guimard
Copy link
Author

guimard commented Sep 30, 2018

To reproduce it, use "taskset -c 0 make test". If only 1 CPU is available or if machine is under heavy load, some tests fails. Maybe a Plack::Test bug ?

@guimard
Copy link
Author

guimard commented Sep 30, 2018

This solves all problems, modifying libplack-perl installation:

--- Plack/Test/Server.pm.orig   2018-09-30 08:33:55.596877032 +0200
+++ Plack/Test/Server.pm        2018-09-30 08:34:12.328689447 +0200
@@ -41,7 +41,7 @@
 sub request {
     my($self, $req) = @_;
 
-    my $ua = $self->{ua} || Plack::LWPish->new( no_proxy => [qw/127.0.0.1/] );
+    my $ua = $self->{ua} || Plack::LWPish->new( no_proxy => [qw/127.0.0.1/], keep_alive => 0 );
 
     $req->uri->scheme('http');
     $req->uri->host($self->{host} || '127.0.0.1');

So either there is a bug in HTTP::Tiny or Feersum closes keep-alive connection before timeout (low configuration machine or heavy load only).

@guimard
Copy link
Author

guimard commented Sep 30, 2018

Here is the final patch:

--- HTTP/Tiny.pm.orig        2018-09-30 09:02:16.674730242 +0200
+++ HTTP/Tiny.pm     2018-09-30 09:02:43.274353687 +0200
@@ -647,6 +647,7 @@
     if ( $self->{keep_alive}
         && $known_message_length
         && $response->{protocol} eq 'HTTP/1.1'
+        && $self->connected
         && ($response->{headers}{connection} || '') ne 'close'
     ) {
         $self->{handle} = $handle;

So last problem for Feersum: it closes connection that were declared "Connection: keep-alive" on heavy load or when only 1 CPU is available.

@guimard
Copy link
Author

guimard commented Oct 11, 2018

Hello,

Feersum is now part of Debian. It will be added to Debian stable in 2019 and to Ubuntu version 19.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant