sureshanaparti commented on code in PR #11376:
URL: https://github.com/apache/cloudstack/pull/11376#discussion_r2249328258


##########
engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java:
##########
@@ -1040,15 +1040,19 @@ protected Status getNextStatusOnDisconnection(Host 
host, final Status.Event even
 
     protected boolean handleDisconnectWithoutInvestigation(final AgentAttache 
attache, final Status.Event event, final boolean transitState, final boolean 
removeAgent) {
         final long hostId = attache.getId();
-
+        final HostVO host = _hostDao.findById(hostId);
         boolean result = false;
         GlobalLock joinLock = getHostJoinLock(hostId);
-        if (joinLock.lock(60)) {
+        try {
+            if (!joinLock.lock(60)) {
+                logger.debug("Unable to acquire lock on host {} to process 
agent disconnection", host != null? host : hostId);
+                return result;
+            }
+
+            logger.debug("Acquired lock on host {}, to process agent 
disconnection", host != null? host : hostId);
             try {

Review Comment:
   _joinLock_ is unlocked in this block, so this is required (and don't want to 
change the existing code now, only try catch for handling unlock and release 
for the acquired lock)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to