Set timeout for SocketSslEchoTest

Motivation:

We are seeing EpollSocketSslEchoTest does not finish itself while its I/O thread is busy.  Jenkins should have terminated them when the global build timeout reaches, but Jenkins seems to fail to do so.  What's more interesting is that Jenkins will start another job before the EpollSocketSslEchoTest is terminated, and Linux starts to oom-kill them, impacting the uptime of the CI service.

Modifications:

- Set timeout for all test cases in SocketSslEchoTest so that all SSL tests terminate themselves when they take too long.
- Fix a bug where the epoll testsuite uses non-daemon threads which can potentially prevent JVM from quitting.
- (Cleanup) Separate boss group and worker group just like we do for NIO/OIO transport testsuite.

Result:

Potentially more stable CI machine.
This commit is contained in:
Trustin Lee 2014-03-17 09:30:58 +09:00
parent 218bb8b034
commit 2de65e25e9
2 changed files with 16 additions and 5 deletions

View File

@ -85,7 +85,7 @@ public class SocketSslEchoTest extends AbstractSocketTest {
this.useCompositeByteBuf = useCompositeByteBuf;
}
@Test
@Test(timeout = 30000)
public void testSslEcho() throws Throwable {
run();
}
@ -94,7 +94,7 @@ public class SocketSslEchoTest extends AbstractSocketTest {
testSslEcho(sb, cb, true);
}
@Test
@Test(timeout = 30000)
public void testSslEchoNotAutoRead() throws Throwable {
run();
}

View File

@ -18,24 +18,35 @@ package io.netty.channel.epoll;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.testsuite.transport.TestsuitePermutation;
import io.netty.util.concurrent.DefaultThreadFactory;
import java.util.Collections;
import java.util.List;
final class EpollTestUtils {
private static final EventLoopGroup GROUP = new EpollEventLoopGroup();
private static final int BOSSES = 2;
private static final int WORKERS = 3;
private static final EventLoopGroup epollBossGroup =
new NioEventLoopGroup(BOSSES, new DefaultThreadFactory("testsuite-epoll-boss", true));
private static final EventLoopGroup epollWorkerGroup =
new NioEventLoopGroup(WORKERS, new DefaultThreadFactory("testsuite-epoll-worker", true));
static List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
return Collections.<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>>singletonList(
new TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>() {
@Override
public ServerBootstrap newServerInstance() {
return new ServerBootstrap().group(GROUP).channel(EpollServerSocketChannel.class);
return new ServerBootstrap().group(
epollBossGroup, epollWorkerGroup).channel(EpollServerSocketChannel.class);
}
@Override
public Bootstrap newClientInstance() {
return new Bootstrap().group(GROUP).channel(EpollSocketChannel.class);
return new Bootstrap().group(epollWorkerGroup).channel(EpollSocketChannel.class);
}
});
}