redis plugin trying to connect with mapped ipv6 address, fails

Description

I've just tried to connect a logstash agent to a redis server on another host, and just get repeated 'Network is unreachable' errors from the agent. A bit more digging shows that it's trying to do this (IP address changed to 11.22.33.44):

connect(13, {sa_family=AF_INET6, sin6_port=htons(6379), inet_pton(AF_INET6, "::ffff:11.22.33.44", &sin6_addr)

The relevant portion of my logstash config reads

output {
redis { host => "11.22.33.44" data_type => "list" key => "logstash" }
}

Java details:

java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.13) (6b18-1.8.13-0+squeeze2)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

The agent host doesn't have a local ipv6 address. So it seems that something somewhere is defaulting to use AF_INET6, doing the ip4-ip6 mapping, but failing because the host isn't natively ipv6.

Gliffy Diagrams

Activity

Show:

Jordan Sissel March 18, 2013 at 8:58 PM

You should also be able to set java.net.preferIPv4Stack to avoid this problem as well.

java -Djava.net.preferIPv4Stack=true -jar logstash.jar ....

Ian Chard March 18, 2013 at 2:42 PM

Cracked it. It's related to Debian bug #560056: the now-default sysctl setting net.ipv6.bindv6only=1 breaks Java networking. Setting this value to 0 gets logstash working like a charm. Lovely

Fixed

Details

Assignee

Reporter

Affects versions

Created March 18, 2013 at 12:29 PM
Updated April 19, 2013 at 8:19 PM
Resolved March 18, 2013 at 9:05 PM