mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Bug CS-17825: Don't rely on XS to cleanup idle session but proactively close it from console proxy
This commit is contained in:
parent
4fce6448e6
commit
f38c4e9ea6
@ -253,7 +253,8 @@ public abstract class ConsoleProxyClientBase implements ConsoleProxyClient, Cons
|
||||
|
||||
if(s_logger.isTraceEnabled())
|
||||
s_logger.trace("Ajax client start, frame buffer w: " + width + ", " + height);
|
||||
|
||||
|
||||
/*
|
||||
int retry = 0;
|
||||
tracker.initCoverageTest();
|
||||
while(!tracker.hasFullCoverage() && retry < 10) {
|
||||
@ -263,6 +264,7 @@ public abstract class ConsoleProxyClientBase implements ConsoleProxyClient, Cons
|
||||
}
|
||||
retry++;
|
||||
}
|
||||
*/
|
||||
|
||||
List<TileInfo> tiles = tracker.scan(true);
|
||||
String imgUrl = prepareAjaxImage(tiles, true);
|
||||
|
||||
@ -64,6 +64,7 @@ public class ConsoleProxyGCThread extends Thread {
|
||||
public void run() {
|
||||
|
||||
boolean bReportLoad = false;
|
||||
long lastReportTick = System.currentTimeMillis();
|
||||
while (true) {
|
||||
cleanupLogging();
|
||||
bReportLoad = false;
|
||||
@ -95,10 +96,12 @@ public class ConsoleProxyGCThread extends Thread {
|
||||
client.closeClient();
|
||||
}
|
||||
|
||||
if(bReportLoad) {
|
||||
if(bReportLoad || System.currentTimeMillis() - lastReportTick > 5000) {
|
||||
// report load changes
|
||||
String loadInfo = new ConsoleProxyClientStatsCollector(connMap).getStatsReport();
|
||||
ConsoleProxy.reportLoadInfo(loadInfo);
|
||||
lastReportTick = System.currentTimeMillis();
|
||||
|
||||
if(s_logger.isDebugEnabled())
|
||||
s_logger.debug("Report load change : " + loadInfo);
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ public class ConsoleProxyVncClient extends ConsoleProxyClientBase {
|
||||
|
||||
private VncClient client;
|
||||
private Thread worker;
|
||||
private boolean workerDone = false;
|
||||
private volatile boolean workerDone = false;
|
||||
|
||||
private int lastModifierStates = 0;
|
||||
private int lastPointerMask = 0;
|
||||
@ -80,7 +80,7 @@ public class ConsoleProxyVncClient extends ConsoleProxyClientBase {
|
||||
String tunnelUrl = getClientParam().getClientTunnelUrl();
|
||||
String tunnelSession = getClientParam().getClientTunnelSession();
|
||||
|
||||
for(int i = 0; i < 15; i++) {
|
||||
for(int i = 0; i < 15 && !workerDone; i++) {
|
||||
try {
|
||||
if(tunnelUrl != null && !tunnelUrl.isEmpty() && tunnelSession != null && !tunnelSession.isEmpty()) {
|
||||
URI uri = new URI(tunnelUrl);
|
||||
@ -136,6 +136,7 @@ public class ConsoleProxyVncClient extends ConsoleProxyClientBase {
|
||||
|
||||
@Override
|
||||
public void closeClient() {
|
||||
workerDone = true;
|
||||
if(client != null)
|
||||
client.shutdown();
|
||||
}
|
||||
|
||||
@ -77,8 +77,10 @@ public class VncClientPacketSender implements Runnable, PaintNotificationListene
|
||||
s_logger.error("Unexpected exception: ", e);
|
||||
if (connectionAlive) {
|
||||
closeConnection();
|
||||
vncConnection.shutdown();
|
||||
}
|
||||
} finally {
|
||||
s_logger.info("Sending thread exit processing, shutdown connection");
|
||||
vncConnection.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -90,8 +90,10 @@ public class VncServerPacketReceiver implements Runnable {
|
||||
s_logger.error("Unexpected exception: ", e);
|
||||
if (connectionAlive) {
|
||||
closeConnection();
|
||||
vncConnection.shutdown();
|
||||
}
|
||||
} finally {
|
||||
s_logger.info("Receiving thread exit processing, shutdown connection");
|
||||
vncConnection.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user