[Catalyst] Development Server Crashing

Brandon Black blblack at gmail.com
Thu Jun 22 05:39:46 CEST 2006


On 6/21/06, hkclark at gmail.com <hkclark at gmail.com> wrote:
> When I run "script/myapp_server.pl -k" with the keepalive option (so
> that things work with IE), I get the following crash (not right away,
> but usually within the first few clicks):
>
> Use of uninitialized value in subroutine entry at
> /usr/lib/perl5/5.8.5/i386-linux-thread-multi/Socket.pm line 370.
> Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be
> 16 at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/Socket.pm line 370.
>
> Has anyone else run into this?
>
> Pretty much all of my modules are the latest & greatest from CPAN.

I haven't run into this with Catalyst myself, but I have seen this
issue in general a few times in the past, in totally different
contexts.  My strong suspicion is that the problem lies in the method
"_socket_data" in Catalyst::Engine::HTTP.

If you look there, you will see where the results of getpeername() and
getsockname() are used as arguments to sockaddr_in() in array context
without checking validity first.  sockaddr_in() in array context calls
unpack_sockaddr_in, which is then voicing the complaint you're seeing.

Probably patching that subroutine to do something sane when !true
values are returned by get{peer|sock}name would do the trick.  Like
pretending the address is 0.0.0.0 or some such thing.



More information about the Catalyst mailing list