Skip to content

Commit

Permalink
Only store writer when there's no body. This revealed a rare condition
Browse files Browse the repository at this point in the history
where the handler returns something that is expected to be garbage
collected, like EV::IO from AnyEvent::HTTPD's ->respond method and
causes issues.
  • Loading branch information
miyagawa committed Feb 4, 2010
1 parent 4b49c30 commit 5249c6b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Tatsumaki/Handler.pm
Expand Up @@ -114,8 +114,9 @@ sub run {
$cv->cb(sub {
my $cv = shift;
try {
my $w = $start_response->($cv->recv);
if ($w) {
my $res = $cv->recv;
my $w = $start_response->($res);
if (!$res->[2] && $w) {
$self->writer($w);
$self->condvar(my $cv2 = AE::cv);
$self->request->env->{'psgix.block.body'} = sub { $cv2->recv };
Expand Down

0 comments on commit 5249c6b

Please sign in to comment.