This is an automated email from the ASF dual-hosted git repository.

elserj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 5e01176  TServerUtilsTest fails on master and OSX
5e01176 is described below

commit 5e011764f9e43925e7fffcd1d68811a4ede5a199
Author: Josh Elser <els...@apache.org>
AuthorDate: Fri Sep 14 16:01:02 2018 -0400

    TServerUtilsTest fails on master and OSX
    
    A couple of tests fail in this class because the test binds to 
localhost:<port>
    but then TServerSocket (via TServerUtils) binds to `0.0.0.0` which doesn't
    cause an exception to be thrown (testing for the port collision).
    
    Closes #649
    
    Signed-Off-By: Christopher Tubbs <ctubb...@apache.org>
    Signed-Off-By: Keith Turner <ke...@deenlo.com>
---
 .../main/java/org/apache/accumulo/server/rpc/TServerUtils.java    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java 
b/server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java
index 6a6de4e..af2871e 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java
@@ -276,7 +276,9 @@ public class TServerUtils {
       TProtocolFactory protocolFactory, long maxMessageSize, String 
serverName, int numThreads,
       int numSimpleTimerThreads, long timeBetweenThreadChecks) throws 
TTransportException {
 
-    TServerSocket transport = new TServerSocket(address.getPort());
+    InetSocketAddress isa = new InetSocketAddress(address.getHost(), 
address.getPort());
+    // Must use an ISA, providing only a port would ignore the hostname given
+    TServerSocket transport = new TServerSocket(isa);
     ThreadPoolExecutor pool = createSelfResizingThreadPool(serverName, 
numThreads,
         numSimpleTimerThreads, timeBetweenThreadChecks);
     TThreadPoolServer server = createTThreadPoolServer(transport, processor,
@@ -433,7 +435,9 @@ public class TServerUtils {
     // when the server does an accept() to (presumably) wake up the eventing 
system.
     log.info("Creating SASL thread pool thrift server on listening on {}:{}", 
address.getHost(),
         address.getPort());
-    TServerSocket transport = new TServerSocket(address.getPort(), (int) 
socketTimeout);
+    InetSocketAddress isa = new InetSocketAddress(address.getHost(), 
address.getPort());
+    // Must use an ISA, providing only a port would ignore the hostname given
+    TServerSocket transport = new TServerSocket(isa, (int) socketTimeout);
 
     String hostname, fqdn;
     try {

Reply via email to