You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2023/08/18 09:12:19 UTC
[cloudstack] branch 4.18 updated: cpvm: Fix CPVM not releasing CPU after closing console (#7826)
This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch 4.18
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.18 by this push:
new f7345e861f8 cpvm: Fix CPVM not releasing CPU after closing console (#7826)
f7345e861f8 is described below
commit f7345e861f832dbf5576c24c21eef73d72fe5d58
Author: João Jandre <48...@users.noreply.github.com>
AuthorDate: Fri Aug 18 06:12:06 2023 -0300
cpvm: Fix CPVM not releasing CPU after closing console (#7826)
---
.../java/com/cloud/consoleproxy/ConsoleProxyNoVncClient.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/services/console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyNoVncClient.java b/services/console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyNoVncClient.java
index 2dfea2251fb..27fabb53124 100644
--- a/services/console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyNoVncClient.java
+++ b/services/console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyNoVncClient.java
@@ -113,30 +113,34 @@ public class ConsoleProxyNoVncClient implements ConsoleProxyClient {
if (client.isVncOverWebSocketConnectionOpen()) {
updateFrontEndActivityTime();
}
- connectionAlive = client.isVncOverWebSocketConnectionAlive();
+ connectionAlive = session.isOpen();
try {
Thread.sleep(1);
- } catch (Exception e) {
- s_logger.warn("Error on sleep for vnc over websocket", e);
+ } catch (InterruptedException e) {
+ s_logger.error("Error on sleep for vnc over websocket", e);
}
} else if (client.isVncOverNioSocket()) {
byte[] bytesArr;
int nextBytes = client.getNextBytes();
bytesArr = new byte[nextBytes];
client.readBytes(bytesArr, nextBytes);
+ s_logger.trace(String.format("Read [%s] bytes from client [%s]", nextBytes, clientId));
if (nextBytes > 0) {
session.getRemote().sendBytes(ByteBuffer.wrap(bytesArr));
updateFrontEndActivityTime();
+ } else {
+ connectionAlive = session.isOpen();
}
} else {
b = new byte[100];
readBytes = client.read(b);
+ s_logger.trace(String.format("Read [%s] bytes from client [%s]", readBytes, clientId));
if (readBytes == -1 || (readBytes > 0 && !sendReadBytesToNoVNC(b, readBytes))) {
connectionAlive = false;
}
}
}
- connectionAlive = false;
+ s_logger.info(String.format("Connection with client [%s] is dead.", clientId));
} catch (IOException e) {
s_logger.error("Error on VNC client", e);
}