Marcus Sorensen created CLOUDSTACK-8387:
-------------------------------------------

             Summary: 4.5, master mgmt cluster nodes fail to connect
                 Key: CLOUDSTACK-8387
                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8387
             Project: CloudStack
          Issue Type: Bug
      Security Level: Public (Anyone can view this level - this is the default.)
          Components: Management Server
    Affects Versions: 4.5.0, Future, 4.5.1
            Reporter: Marcus Sorensen


A recent fix for coverity changed the SSL connection initialization between 
mgmt servers to return a null channel, by setting up a new channel and not 
returning it. This patch needs to be reverted or fixed.

Note this method returns 'ch', but the patch sets up 'ch1' and does not return 
it.

diff --git 
a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
index 600dca2..e38489b 100755
--- 
a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
+++ 
b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
@@ -498,18 +498,17 @@ public class ClusteredAgentManagerImpl extends
AgentManagerImpl implements Clust
                 } catch (UnknownHostException e) {
                     throw new CloudRuntimeException("Unable to resolve " + ip);
                 }
-                try {
-                    ch = SocketChannel.open(new
InetSocketAddress(addr, Port.value()));
-                    ch.configureBlocking(true); // make sure we are
working at blocking mode
-                    ch.socket().setKeepAlive(true);
-                    ch.socket().setSoTimeout(60 * 1000);
+                try (SocketChannel ch1 = SocketChannel.open(new
InetSocketAddress(addr, Port.value()));){
+                    ch1.configureBlocking(true); // make sure we are
working at blocking mode
+                    ch1.socket().setKeepAlive(true);
+                    ch1.socket().setSoTimeout(60 * 1000);
                     try {
                         SSLContext sslContext = Link.initSSLContext(true);
                         sslEngine = sslContext.createSSLEngine(ip,
Port.value());
                         sslEngine.setUseClientMode(true);

sslEngine.setEnabledProtocols(SSLUtils.getSupportedProtocols(sslEngine.getEnabledProtocols()));

-                        Link.doHandshake(ch, sslEngine, true);
+                        Link.doHandshake(ch1, sslEngine, true);
                         s_logger.info("SSL: Handshake done");
                     } catch (Exception e) {
                         throw new IOException("SSL: Fail to init SSL! " + e);



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

Reply via email to