You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2015/09/23 07:52:31 UTC

[1/3] git commit: updated refs/heads/master to 1a47437

Repository: cloudstack
Updated Branches:
  refs/heads/master 86325cbc9 -> 1a474374b


Call cleanUp() before looping isStartup().


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9693b97c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9693b97c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9693b97c

Branch: refs/heads/master
Commit: 9693b97c2147b3fdb9579a1ebb33597cd3bf1d11
Parents: a5ca762
Author: Boris Schrijver <bo...@pcextreme.nl>
Authored: Mon Sep 21 16:54:56 2015 +0200
Committer: Boris Schrijver <bo...@pcextreme.nl>
Committed: Mon Sep 21 16:54:56 2015 +0200

----------------------------------------------------------------------
 agent/src/com/cloud/agent/Agent.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9693b97c/agent/src/com/cloud/agent/Agent.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/Agent.java b/agent/src/com/cloud/agent/Agent.java
index e3510c4..f39d0e7 100644
--- a/agent/src/com/cloud/agent/Agent.java
+++ b/agent/src/com/cloud/agent/Agent.java
@@ -394,15 +394,17 @@ public class Agent implements HandlerFactory, IAgentControl {
         } while (inProgress > 0);
 
         _connection.stop();
-        while (_connection.isStartup()) {
-            _shell.getBackoffAlgorithm().waitBeforeRetry();
-        }
 
         try {
             _connection.cleanUp();
         } catch (final IOException e) {
             s_logger.warn("Fail to clean up old connection. " + e);
         }
+
+        while (_connection.isStartup()) {
+            _shell.getBackoffAlgorithm().waitBeforeRetry();
+        }
+
         _connection = new NioClient("Agent", _shell.getHost(), _shell.getPort(), _shell.getWorkers(), this);
         do {
             s_logger.info("Reconnecting...");


[3/3] git commit: updated refs/heads/master to 1a47437

Posted by ra...@apache.org.
Merge pull request #863 from borisroman/CLOUDSTACK-8883

[4.6][BLOCKER]CLOUDSTACK-8883: Resolved connect/reconnect issue.Hi!

@wilderrodrigues by implementing Callable you switched a couple of methods and fields. I switched them some more!

The reason why the Agent wouldn't reconnect was due to two facts.

Problem 1: Selector was blocking.
In the while loop at [1] _selector.select(); was blocking when the connection was lost. This means at [2] _isStartup = false; was never excecuted. Therefore at [3] the call to isStartup() always returned true resulting in an infinite loop.

Resolution 1: Move the call to cleanUp() [4] before checking if isStartup() has turned to false. cleanUp() will close() the _selector resulting in _isStartup to be set to false.

Problem 2: Setting _isStartup & _isRunning to true when init() throwed an unchecked exception (ConnectException).
The exception was nicely caught, but only logged. No action was taken! Resulting in _isStartup & _isRunning being set to true. Resulting in the fact the Agent thought it was connected successfully, though it wasn't.

Resolution 2: Adding return to the catch statement [5]. This way _isStartup & _isRunning aren't set to true.

Steps to test:
1. Deploy ACS.
2. Try all combinations of stopping/starting managment server/agent.

[1]https://github.com/borisroman/cloudstack/blob/b34f86c8d55a1cfc057585eab4db0fa2d98a7b3e/utils/src/main/java/com/cloud/utils/nio/NioConnection.java#L128
[2]https://github.com/borisroman/cloudstack/blob/b34f86c8d55a1cfc057585eab4db0fa2d98a7b3e/utils/src/main/java/com/cloud/utils/nio/NioConnection.java#L176
[3]https://github.com/borisroman/cloudstack/blob/b34f86c8d55a1cfc057585eab4db0fa2d98a7b3e/agent/src/com/cloud/agent/Agent.java#L404
[4]https://github.com/borisroman/cloudstack/blob/b34f86c8d55a1cfc057585eab4db0fa2d98a7b3e/agent/src/com/cloud/agent/Agent.java#L399
[5]https://github.com/borisroman/cloudstack/blob/b34f86c8d55a1cfc057585eab4db0fa2d98a7b3e/utils/src/main/java/com/cloud/utils/nio/NioConnection.java#L91

* pr/863:
  Added return statement to stop start() if there has been an ConnectException.
  Call cleanUp() before looping isStartup().

Signed-off-by: Rajani Karuturi <ra...@citrix.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1a474374
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1a474374
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1a474374

Branch: refs/heads/master
Commit: 1a474374b9c936ed40a1d83ce8b75ea189f23399
Parents: 86325cb b34f86c
Author: Rajani Karuturi <ra...@citrix.com>
Authored: Wed Sep 23 11:21:39 2015 +0530
Committer: Rajani Karuturi <ra...@citrix.com>
Committed: Wed Sep 23 11:21:41 2015 +0530

----------------------------------------------------------------------
 agent/src/com/cloud/agent/Agent.java                       | 8 +++++---
 utils/src/main/java/com/cloud/utils/nio/NioConnection.java | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[2/3] git commit: updated refs/heads/master to 1a47437

Posted by ra...@apache.org.
Added return statement to stop start() if there has been an ConnectException.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b34f86c8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b34f86c8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b34f86c8

Branch: refs/heads/master
Commit: b34f86c8d55a1cfc057585eab4db0fa2d98a7b3e
Parents: 9693b97
Author: Boris Schrijver <bo...@pcextreme.nl>
Authored: Tue Sep 22 00:38:16 2015 +0200
Committer: Boris Schrijver <bo...@pcextreme.nl>
Committed: Tue Sep 22 00:38:16 2015 +0200

----------------------------------------------------------------------
 utils/src/main/java/com/cloud/utils/nio/NioConnection.java | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b34f86c8/utils/src/main/java/com/cloud/utils/nio/NioConnection.java
----------------------------------------------------------------------
diff --git a/utils/src/main/java/com/cloud/utils/nio/NioConnection.java b/utils/src/main/java/com/cloud/utils/nio/NioConnection.java
index ddc84cf..249f512 100644
--- a/utils/src/main/java/com/cloud/utils/nio/NioConnection.java
+++ b/utils/src/main/java/com/cloud/utils/nio/NioConnection.java
@@ -88,6 +88,7 @@ public abstract class NioConnection implements Callable<Boolean> {
             init();
         } catch (final ConnectException e) {
             s_logger.warn("Unable to connect to remote: is there a server running on port " + _port);
+            return;
         } catch (final IOException e) {
             s_logger.error("Unable to initialize the threads.", e);
             throw new NioConnectionException(e.getMessage(), e);