You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been testing Twiggy with long-lasting queries and found out that it can be crashed/confused (depending on OS and event loop engine used) by suddenly closing connection on the client side.
Here's a sample PSGI app that reliably reproduces this situation. It outputs 12345 in 5 seconds:
#!/usr/bin/perl -w
use strict;
use AnyEvent;
my $app = sub {
my $env = shift;
return sub {
my $responder = shift;
my $writer = $responder->([200, [ 'Content-Type' => 'text/plain' ]]);
# set up timer
my $tm;
my $stage;
$tm = AnyEvent->timer( after => 1, interval => 1, cb => sub {
if (++$stage<=5) { # print 1..5
$writer->write($stage);
} else { # stop here
$writer->close;
$tm = undef;
};
});
};
};
After running twiggy 12345.psgi, the event can be triggered by this one-liner:
perl -we 'alarm 1; use LWP::UserAgent; my $ag = LWP::UserAgent->new; $ag->get("http://127.0.0.1:5000/");
Here's error message from my Linux box:
EV: error in callback (ignoring): AnyEvent::Handle uncaught error: Broken pipe at lib/Twiggy/Server.pm line 601
It looks like the problem can be solved by setting on_error on Twiggy::Writer's handle. However, I'm not sure where to set it (in constructor maybe?) so I'm not proposing a patch right away.
The text was updated successfully, but these errors were encountered:
ISim
pushed a commit
to ISim/Twiggy
that referenced
this issue
Apr 16, 2015
Hello,
This is a duplicate of issue in RT https://rt.cpan.org/Public/Bug/Display.html?id=78177
I've been testing Twiggy with long-lasting queries and found out that it can be crashed/confused (depending on OS and event loop engine used) by suddenly closing connection on the client side.
Here's a sample PSGI app that reliably reproduces this situation. It outputs 12345 in 5 seconds:
After running
twiggy 12345.psgi
, the event can be triggered by this one-liner:Here's error message from my Linux box:
It looks like the problem can be solved by setting on_error on Twiggy::Writer's handle. However, I'm not sure where to set it (in constructor maybe?) so I'm not proposing a patch right away.
The text was updated successfully, but these errors were encountered: