Re: Socket error, info "Invalid Argument"

From: Willy Tarreau <w#1wt.eu>
Date: Tue, 5 Apr 2011 14:44:27 +0200


Hi John,

On Tue, Apr 05, 2011 at 11:44:40AM +0100, John Helliwell wrote:
> Thanks, I've started the 1.5dev5 daemon, and copied what I think is relevant
> from the truss output
> pollsys(0x004DAD00, 4, 0xFFBFFCA0, 0x00000000) = 1
> accept(7, 0xFFBFFB98, 0xFFBFFB94, SOV_DEFAULT) = 0
> fcntl(0, F_SETFL, FNONBLOCK) = 0
> setsockopt(0, tcp, TCP_NODELAY, 0x0006F718, 4, SOV_DEFAULT) = 0
> accept(7, 0xFFBFFB98, 0xFFBFFB94, SOV_DEFAULT) Err#11 EAGAIN
> pollsys(0x004DAD00, 5, 0xFFBFFCA0, 0x00000000) = 1
> recv(0, " G E T / H T T P / 1".., 8192, 0) = 341
> getsockopt(0, SOL_SOCKET, SO_ERROR, 0xFFBFFAB4, 0xFFBFFAB0, SOV_DEFAULT) = 0
> send(0, " H T T P / 1 . 0 2 0 0".., 12682, 128) = 12682
> pollsys(0x004DAD00, 5, 0xFFBFFCA0, 0x00000000) = 0
> getsockopt(0, SOL_SOCKET, SO_ERROR, 0xFFBFFAB4, 0xFFBFFAB0, SOV_DEFAULT) = 0
> send(0, " < t r c l a s s = " a".., 12438, 128) = 12438
> pollsys(0x004DAD00, 5, 0xFFBFFCA0, 0x00000000) = 0
> pollsys(0x004DAD00, 5, 0xFFBFFCA0, 0x00000000) = 0
> pollsys(0x004DAD00, 5, 0xFFBFFCA0, 0x00000000) = 1
> getsockopt(0, SOL_SOCKET, SO_ERROR, 0xFFBFFC24, 0xFFBFFC20, SOV_DEFAULT) = 0
> send(0, " < t r c l a s s = " b".., 770, 128) = 770
> shutdown(0, SHUT_WR, SOV_DEFAULT) = 0
> close(0) = 0
> sendto(5, " < 1 3 1 > A p r 5 ".., 172, 128, 0x00124598, 256) Err#22
> EINVAL
> sendto(5, " < 1 3 9 > A p r 5 ".., 172, 128, 0x00124698, 256) Err#22
> EINVAL
> pollsys(0x004DAD00, 4, 0xFFBFFCA0, 0x00000000) = 0
> so_socket(PF_INET, SOCK_STREAM, IPPROTO_TCP, "", SOV_DEFAULT) = 0
> fcntl(0, F_SETFL, FNONBLOCK) = 0
> setsockopt(0, tcp, TCP_NODELAY, 0x0006F718, 4, SOV_DEFAULT) = 0
> connect(0, 0xFFBFFB98, 256, SOV_DEFAULT) Err#22 EINVAL

OK so it's the connect() which fails on sockaddr_storage. I find this rather strange. Do you know if it works when you disable the checks ? I'm asking because the connect() call differs slightly between the checks and the normal sockets. I think it will fail too anyway.

You can also try to write your server addresses in IPv6 format : "1.2.3.4" becomes "::1.2.3.4". This will result in connect() being called with an IPv4-in-IPv6 address. What I'm suspecting is that in your case, connect() only supports IPv6 format with sockaddr_storage, eventhough I find this quite strange.

I'll try on my ultra5 in case I can reproduce it (solaris 8).

Thanks,
Willy Received on 2011/04/05 14:44

This archive was generated by hypermail 2.2.0 : 2011/04/05 15:00 CEST