Is anyone running 4.5 mgmt server in cluster setup? I've run into an
issue where the channel between the two servers is null, and I think
I've tracked it down to "coverity fixes" from
78bfaa79cf3eaa170ef9422bf8fb1825c0cecfc1.

The method returns 'ch', which is null in the error. The coverity fix
changes ch for ch1 and seems to initialize ch1 and then drop it on the
floor. If someone is familiar with this code I'd appreciate a review
of 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);

Reply via email to