Copilot commented on code in PR #11540:
URL: https://github.com/apache/cloudstack/pull/11540#discussion_r2313302609
##########
client/src/main/java/org/apache/cloudstack/ServerDaemon.java:
##########
@@ -147,6 +151,8 @@ public void init(final DaemonContext context) {
setSessionTimeout(Integer.valueOf(properties.getProperty(SESSION_TIMEOUT,
"30")));
setMaxFormContentSize(Integer.valueOf(properties.getProperty(REQUEST_CONTENT_SIZE_KEY,
String.valueOf(DEFAULT_REQUEST_CONTENT_SIZE))));
setMaxFormKeys(Integer.valueOf(properties.getProperty(REQUEST_MAX_FORM_KEYS_KEY,
String.valueOf(DEFAULT_REQUEST_MAX_FORM_KEYS))));
+ setMinThreads(Integer.valueOf(properties.getProperty(THREADS_MIN,
"10")));
+ setMaxThreads(Integer.valueOf(properties.getProperty(THREADS_MAX,
"500")));
Review Comment:
Missing input validation for thread configuration values. The code should
validate that minThreads > 0, maxThreads > 0, and minThreads <= maxThreads to
prevent invalid thread pool configurations that could cause runtime issues.
```suggestion
setMaxThreads(Integer.valueOf(properties.getProperty(THREADS_MAX, "500")));
// Validate thread configuration
if (minThreads <= 0) {
logger.warn("Invalid minThreads value (" + minThreads + ").
Setting to default (10).");
setMinThreads(10);
}
if (maxThreads <= 0) {
logger.warn("Invalid maxThreads value (" + maxThreads + ").
Setting to default (500).");
setMaxThreads(500);
}
if (minThreads > maxThreads) {
logger.warn("minThreads (" + minThreads + ") is greater than
maxThreads (" + maxThreads + "). Setting minThreads to maxThreads.");
setMinThreads(maxThreads);
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]