Skip to content

Commit

Permalink
RT#65616: Fix for slow methods killing servers.
Browse files Browse the repository at this point in the history
Applied and modified patch from person who opened the ticket.
  • Loading branch information
rjray committed Aug 19, 2011
1 parent 8008995 commit cc02b29
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/RPC/XML/Server.pm
Expand Up @@ -110,7 +110,7 @@ BEGIN
);
}

$VERSION = '1.67';
$VERSION = '1.68';
$VERSION = eval $VERSION; ## no critic (ProhibitStringyEval)

###############################################################################
Expand Down Expand Up @@ -616,7 +616,8 @@ sub server_loop ## no critic (RequireArgUnpacking,ProhibitExcessComplexity)

if ($self->{__daemon})
{
my ($conn, $req, $resp, $reqxml, $respxml, $exit_now, $timeout);
my ($conn, $req, $resp, $reqxml, $respxml, $exit_now, $timeout,
$eval_return);

my %args = @_;

Expand Down Expand Up @@ -652,7 +653,17 @@ sub server_loop ## no critic (RequireArgUnpacking,ProhibitExcessComplexity)
}
$conn->timeout($self->timeout);
$self->process_request($conn);
$conn->close;

$eval_return = eval {
local $SIG{PIPE} = sub { die "server_loop: Caught SIGPIPE\n"; };
$conn->close;
1;
};
if ((! $eval_return) && $@)
{
warn "Cannot close conection: $@\n";
}

undef $conn; # Free up any lingering resources
}

Expand Down

0 comments on commit cc02b29

Please sign in to comment.