cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Trubachev (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CASSANDRA-9137) nodetool doesn't work when Cassandra run with the property java.net.preferIPv6Addresses=true
Date Wed, 08 Apr 2015 21:06:15 GMT
Andrey Trubachev created CASSANDRA-9137:
-------------------------------------------

             Summary: nodetool doesn't work when Cassandra run with the property java.net.preferIPv6Addresses=true
                 Key: CASSANDRA-9137
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9137
             Project: Cassandra
          Issue Type: Bug
          Components: Core
            Reporter: Andrey Trubachev


nodetool doesn't work when Cassandra run with the property {{java.net.preferIPv6Addresses=true}}.
{noformat}
$ sudo netstat -tlpn | grep $(cat /var/run/cassandra/cassandra.pid) | grep 7199
tcp6       0      0 ::1:7199                :::*                    LISTEN      27560/java
{noformat}
{noformat}
$ nodetool -h ::1 status
nodetool: Failed to connect to '::1:7199' - ConnectException: 'Connection refused'.
{noformat}
Hardcoded value {{127.0.0.1}} of the property {{java.rmi.server.hostname}} (https://github.com/apache/cassandra/blob/cassandra-2.1.4/src/java/org/apache/cassandra/service/CassandraDaemon.java#L91)
makes RMI response with ipv4 address instead of ipv6.
{noformat}
21:52:26.300192 IP6 (hlim 64, next-header TCP (6) payload length: 259) ::1.7199 > ::1.58706:
Flags [P.], cksum 0x010b (incorrect -> 0x6a57), seq 23:250, ack 88, win 2048, options [nop,nop,TS
val 1833457 ecr 1833456], length 227
`......@...................................R.4...../...........
........Q....w..SZ.y...L.[....sr..javax.management.remote.rmi.RMIServerImpl_Stub...........pxr..java.rmi.server.RemoteStub......e....pxr..javSZ.y...L.[.....xoteObject.a...a3....pxpw4..UnicastRef2..
127.0.0.1...(.L....d
21:52:26.336400 IP6 (hlim 64, next-header TCP (6) payload length: 32) ::1.58706 > ::1.7199:
Flags [.], cksum 0x0028 (incorrect -> 0xfe1c), seq 88, ack 250, win 2048, options [nop,nop,TS
val 1833467 ecr 1833457], length 0
`.... .@.................................R...../.4.......(.....
........
{noformat}
jmxServer listen the address that will be resolved and it depends on value or lack of the
property {{java.net.preferIPv6Addresses}} (
https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/utils/RMIServerSocketFactoryImpl.java#L13).
This is a simple patch that works correctly with {{java.net.preferIPv6Addresses=(true|false)}}
and {{java.net.preferIPv4Stack=(true|false)}}:
{code}
diff --git a/src/java/org/apache/cassandra/service/CassandraDaemon.java b/src/java/org/apache/cassandra/service/CassandraDaemon.java
index 3e398bf..66e9cca 100644
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@ -88,7 +88,7 @@ public class CassandraDaemon
             }
             else
             {
-                System.setProperty("java.rmi.server.hostname","127.0.0.1");
+                System.setProperty("java.rmi.server.hostname", InetAddress.getLoopbackAddress().getHostAddress());

                 try
                 {
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message