mirror of https://github.com/apache/cloudstack.git
Revert "Merge pull request #1534 from shapeblue/niotest-fix"
This reverts commit9f970f28b1, reversing changes made to6d0c92be72. This was reverted because it seemed to be related to an issue when doing a DeployDC, causing an `addHost` error.
This commit is contained in:
parent
4e1f9cd82a
commit
f175ad1ae0
|
|
@ -596,8 +596,8 @@ public class Link {
|
|||
while (handshakeStatus != SSLEngineResult.HandshakeStatus.FINISHED
|
||||
&& handshakeStatus != SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING) {
|
||||
final long timeTaken = System.currentTimeMillis() - startTimeMills;
|
||||
if (timeTaken > 15000L) {
|
||||
s_logger.warn("SSL Handshake has taken more than 15s to connect to: " + socketChannel.getRemoteAddress() +
|
||||
if (timeTaken > 60000L) {
|
||||
s_logger.warn("SSL Handshake has taken more than 60s to connect to: " + socketChannel.getRemoteAddress() +
|
||||
". Please investigate this connection.");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,8 +171,6 @@ public abstract class NioConnection implements Callable<Boolean> {
|
|||
} catch (final IOException e) {
|
||||
s_logger.error("Agent will die due to this IOException!", e);
|
||||
throw new NioConnectionException(e.getMessage(), e);
|
||||
} finally {
|
||||
_selector.wakeup();
|
||||
}
|
||||
}
|
||||
_isStartup = false;
|
||||
|
|
|
|||
|
|
@ -61,9 +61,9 @@ public class NioTest {
|
|||
private static final Logger LOGGER = Logger.getLogger(NioTest.class);
|
||||
|
||||
// Test should fail in due time instead of looping forever
|
||||
private static final int TESTTIMEOUT = 60000;
|
||||
private static final int TESTTIMEOUT = 300000;
|
||||
|
||||
final private int totalTestCount = 4;
|
||||
final private int totalTestCount = 5;
|
||||
private int completedTestCount = 0;
|
||||
|
||||
private NioServer server;
|
||||
|
|
@ -71,7 +71,7 @@ public class NioTest {
|
|||
private List<NioClient> maliciousClients = new ArrayList<>();
|
||||
|
||||
private ExecutorService clientExecutor = Executors.newFixedThreadPool(totalTestCount, new NamedThreadFactory("NioClientHandler"));;
|
||||
private ExecutorService maliciousExecutor = Executors.newFixedThreadPool(totalTestCount, new NamedThreadFactory("MaliciousNioClientHandler"));;
|
||||
private ExecutorService maliciousExecutor = Executors.newFixedThreadPool(5*totalTestCount, new NamedThreadFactory("MaliciousNioClientHandler"));;
|
||||
|
||||
private Random randomGenerator = new Random();
|
||||
private byte[] testBytes;
|
||||
|
|
@ -105,18 +105,12 @@ public class NioTest {
|
|||
Assert.fail(e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* The malicious client(s) tries to block NioServer's main IO loop
|
||||
* thread until SSL handshake timeout value (from Link class, 15s) after
|
||||
* which the valid NioClient(s) get the opportunity to make connection(s)
|
||||
*/
|
||||
for (int i = 0; i < totalTestCount; i++) {
|
||||
final NioClient maliciousClient = new NioMaliciousClient("NioMaliciousTestClient-" + i, "127.0.0.1", server.getPort(), 1, new NioMaliciousTestClient());
|
||||
maliciousClients.add(maliciousClient);
|
||||
maliciousExecutor.submit(new ThreadedNioClient(maliciousClient));
|
||||
}
|
||||
|
||||
for (int i = 0; i < totalTestCount; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
final NioClient maliciousClient = new NioMaliciousClient("NioMaliciousTestClient-" + i, "127.0.0.1", server.getPort(), 1, new NioMaliciousTestClient());
|
||||
maliciousClients.add(maliciousClient);
|
||||
maliciousExecutor.submit(new ThreadedNioClient(maliciousClient));
|
||||
}
|
||||
final NioClient client = new NioClient("NioTestClient-" + i, "127.0.0.1", server.getPort(), 1, new NioTestClient());
|
||||
clients.add(client);
|
||||
clientExecutor.submit(new ThreadedNioClient(client));
|
||||
|
|
@ -292,6 +286,7 @@ public class NioTest {
|
|||
LOGGER.info("Server: Received OTHER task");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue