Uh oh!
There was an error while loading. Please reload this page.
Add new config (non-dynamic) for agent connections monitor thread, and keep timeunit to secs (in sync with the earlier Wait config) - #10525
Conversation
sureshanaparti
commented
Mar 7, 2025
@blueorangutan package |
blueorangutan
commented
Mar 7, 2025
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## 4.20 #10525 +/- ##
=========================================
Coverage 16.00% 16.01% - Complexity 13104 13107 +3
=========================================
Files 5651 5651 Lines 495841 495840 -1 Branches 60044 60042 -2 =========================================
+ Hits 79365 79384 +19 + Misses 407613 407592 -21 - Partials 8863 8864 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
blueorangutan
commented
Mar 7, 2025
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12699 |
sureshanaparti
commented
Mar 7, 2025
@blueorangutan test |
blueorangutan
commented
Mar 7, 2025
@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
blueorangutan
commented
Mar 7, 2025
[SF] Trillian Build Failed (tid-12616) |
sureshanaparti
commented
Mar 10, 2025
@blueorangutan test |
blueorangutan
commented
Mar 10, 2025
@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
blueorangutan
commented
Mar 11, 2025
[SF] Trillian test result (tid-12633)
|
shwstppr
left a comment
There was a problem hiding this comment.
@sureshanaparti sorry it was my mistake considering wait config in minutes but can we also add the following change to fix cleanup time in seconds in the task and some optimisation. I'm happy to open a separate PR if needed
diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
index 818a3c5a23..1504af702b 100644
--- a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
@@ -51,8 +51,8 @@ import org.apache.cloudstack.framework.jobs.AsyncJobExecutionContext;
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
import org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDao;
import org.apache.cloudstack.utils.identity.ManagementServerNode;
-import org.apache.commons.collections.MapUtils;
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
+import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.ThreadContext;
@@ -1859,25 +1859,19 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
logger.trace("Agent New Connections Monitor is started.");
final int cleanupTime = Wait.value();
Set<Map.Entry<String, Long>> entrySet = newAgentConnections.entrySet();
- long cutOff = System.currentTimeMillis() - (cleanupTime * 60 * 1000L);
- if (logger.isDebugEnabled()) {
- List<String> expiredConnections = newAgentConnections.entrySet()
- .stream()
- .filter(e -> e.getValue() <= cutOff)
- .map(Map.Entry::getKey)
- .collect(Collectors.toList());
- logger.debug(String.format("Currently %d active new connections, of which %d have expired - %s",
- entrySet.size(),
- expiredConnections.size(),
- StringUtils.join(expiredConnections)));
- }
- for (Map.Entry<String, Long> entry : entrySet) {
- if (entry.getValue() <= cutOff) {
- if (logger.isTraceEnabled()) {
- logger.trace(String.format("Cleaning up new agent connection for %s", entry.getKey()));
- }
- newAgentConnections.remove(entry.getKey());
- }
+ long cutOff = System.currentTimeMillis() - (cleanupTime * 1000L);
+ List<String> expiredConnections = newAgentConnections.entrySet()
+ .stream()
+ .filter(e -> e.getValue() <= cutOff)
+ .map(Map.Entry::getKey)
+ .collect(Collectors.toList());
+ logger.debug("Currently {} active new connections, of which {} have expired - {}",
+ entrySet.size(),
+ expiredConnections.size(),
+ StringUtils.join(expiredConnections));
+ for (String connection : expiredConnections) {
+ logger.trace("Cleaning up new agent connection for {}", connection);
+ newAgentConnections.remove(connection);
}
}
}
Co-authored-by: abhishek.mrt22@gmail.com
sureshanaparti
commented
Mar 17, 2025
updated @shwstppr, missed this, thanks for pointing out. |
sureshanaparti
commented
Mar 17, 2025
@blueorangutan package |
blueorangutan
commented
Mar 17, 2025
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
blueorangutan
commented
Mar 17, 2025
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12804 |
Pearl1594
commented
Mar 17, 2025
@blueorangutan test |
blueorangutan
commented
Mar 17, 2025
@Pearl1594 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
blueorangutan
commented
Mar 17, 2025
[SF] Trillian Build Failed (tid-12731) |
sureshanaparti
commented
Mar 20, 2025
@blueorangutan test |
blueorangutan
commented
Mar 20, 2025
@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
blueorangutan
commented
Mar 20, 2025
[SF] Trillian Build Failed (tid-12785) |
sureshanaparti
commented
Apr 13, 2025
@blueorangutan package |
blueorangutan
commented
Apr 13, 2025
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
blueorangutan
commented
Apr 13, 2025
Packaging result [SF]: ✖️ el8 ✖️ el9 ✔️ debian ✖️ suse15. SL-JID 13031 |
sureshanaparti
commented
Apr 14, 2025
@blueorangutan package |
blueorangutan
commented
Apr 14, 2025
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
blueorangutan
commented
Apr 14, 2025
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13035 |
sureshanaparti
commented
Apr 14, 2025
@blueorangutan test |
blueorangutan
commented
Apr 14, 2025
@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
blueorangutan
commented
Apr 14, 2025
[SF] Trillian test result (tid-12976)
|
DaanHoogland
commented
Apr 15, 2025
@sureshanaparti@Pearl1594 , I added needs-testing to this PR, but I am not really convinced if we need to and how. Can you advise? |
sureshanaparti
commented
Apr 23, 2025
@DaanHoogland Update Wait config, to say 120 secs, enable trace log and check for the log "Agent New Connections Monitor is started", it has to be logged every 120 secs. |
…, instead of using Wait which is dynamic
sureshanaparti
commented
Apr 28, 2025
@blueorangutan package |
@DaanHoogland The agent connections monitor task required restart, I've updated with new config 'agent.connections.monitor.interval' (non-dynamic) to monitor and cleanup new agent connections, instead of using 'Wait' which is dynamic. |
blueorangutan
commented
Apr 28, 2025
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
blueorangutan
commented
Apr 28, 2025
Packaging result [SF]: ✔️ el8 ✔️ el9 ✖️ debian ✔️ suse15. SL-JID 13200 |
DaanHoogland
commented
Apr 28, 2025
tested: |
…d keep timeunit to secs (in sync with the earlier Wait config) (apache#10525)
Description
This PR adds new config 'agent.connections.monitor.interval' (non-dynamic) to monitor and cleanup new agent connections, instead of using 'Wait' which is dynamic, and updates the monitor thread timeunit to secs, in sync with the earlier Wait config.
New agent connections monitor thread introduced here: #9840
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?