[dancer-users] Dancer crashing

David Precious davidp at preshweb.co.uk
Tue Mar 19 13:17:12 GMT 2019


On Wed, 13 Mar 2019 09:58:54 -0700
Chad Wallace <cwallace at lodgingcompany.com> wrote:
> Here are lines 396 and 397 of HTTP/Server/Simple.pm (version 0.52):
> 
>         my $remote_sockaddr = getpeername( $self->stdio_handle );
>         my $family = sockaddr_family($remote_sockaddr);
> 
> So $remote_sockaddr is undef.  It should avoid calling
> sockaddr_family() in that case.

It looks like Chad is right - it would appear to be a problem with
HTTP::Server::Simple.

That means (a) it should be reported there, (b) it should only affect
you while running Dancer standalone.

You could, if you're keen, patch your local HTTP::Server::Simple with a
check that the call to getpeername( $self->stdio_handle ) did indeed
return something useful, before then passing that to sockaddr_family(),
and if not, emit as much potentially-useful debug info as you can, to
try to isolate the conditions under which this could happen.

Some form of stress-testing might help, too - maybe it's a timing
issue, a race condition where another request arrives while a previous
one is in a certain state, where the client (or another/previous
client) drops its connection right whne the server isn't expecting it,
or similar?

Cheers

Dave P


More information about the dancer-users mailing list