Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 023EF17D38 for ; Wed, 8 Apr 2015 21:06:17 +0000 (UTC) Received: (qmail 15255 invoked by uid 500); 8 Apr 2015 21:06:15 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 15094 invoked by uid 500); 8 Apr 2015 21:06:15 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 14845 invoked by uid 99); 8 Apr 2015 21:06:15 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Apr 2015 21:06:15 +0000 Date: Wed, 8 Apr 2015 21:06:15 +0000 (UTC) From: "Andrey Trubachev (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (CASSANDRA-9137) nodetool doesn't work when Cassandra run with the property java.net.preferIPv6Addresses=true MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 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)