You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2014/07/16 16:25:13 UTC
[2/2] git commit: updated refs/heads/master to e78bb1d
Switch the catch to Throwable. Uncaught exceptions in a scheduled
threadpool executor will not report or log uncaught exceptions but will
kill the thread causing unexplained timeouts in CS.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e78bb1d2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e78bb1d2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e78bb1d2
Branch: refs/heads/master
Commit: e78bb1d22571ecfb115d654d08d782af74e98e75
Parents: dbc7d80
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Wed Jul 16 16:22:31 2014 +0200
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Wed Jul 16 16:24:55 2014 +0200
----------------------------------------------------------------------
.../com/cloud/agent/manager/DirectAgentAttache.java | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e78bb1d2/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java b/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java
index 7ca6929..fa89841 100755
--- a/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java
+++ b/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java
@@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.log4j.Logger;
+
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
import com.cloud.agent.api.Answer;
@@ -298,9 +299,10 @@ public class DirectAgentAttache extends AgentAttache {
} else {
answer = new Answer(cmds[i], false, "Agent is disconnected");
}
- } catch (Exception e) {
- s_logger.warn(log(seq, "Exception Caught while executing command"), e);
- answer = new Answer(cmds[i], false, e.toString());
+ } catch (Throwable t) {
+ // Catch Throwable as all exceptions will otherwise be eaten by the executor framework
+ s_logger.warn(log(seq, "Throwable caught while executing command"), t);
+ answer = new Answer(cmds[i], false, t.toString());
}
answers.add(answer);
if (!answer.getResult() && stopOnError) {
@@ -317,8 +319,9 @@ public class DirectAgentAttache extends AgentAttache {
}
processAnswers(seq, resp);
- } catch (Exception e) {
- s_logger.warn(log(seq, "Exception caught "), e);
+ } catch (Throwable t) {
+ // This is pretty serious as processAnswers might not be called and the calling process is stuck waiting for the full timeout
+ s_logger.error(log(seq, "Throwable caught in runInContext, this will cause the management to become unpredictable"), t);
} finally {
_outstandingTaskCount.decrementAndGet();
scheduleFromQueue();