GeezerVison is showing github.com — Await termination of SslHandler executor (#16138) · netty/netty@eaf46b8
File treeExpand file treeCollapse file tree Open diff view settings handler/src/test/java/io/netty/handler/ssl testsuite/src/main/java/io/netty/testsuite/transport/socket transport-blockhound-tests/src/test/java/io/netty/util/internal
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: handler/src/test/java/io/netty/handler/ssl/CipherSuiteCanaryTest.java +5-4Lines changed: 5 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -232,16 +232,17 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) | 232 | 232 | } | 233 | 233 | } finally { | 234 | 234 | server.close().sync(); | | 235 | + | | 236 | + if (executorService != null) { | | 237 | + executorService.shutdown(); | | 238 | + assertTrue(executorService.awaitTermination(5, TimeUnit.SECONDS)); | | 239 | + } | 235 | 240 | } | 236 | 241 | } finally { | 237 | 242 | ReferenceCountUtil.release(sslClientContext); | 238 | 243 | } | 239 | 244 | } finally { | 240 | 245 | ReferenceCountUtil.release(sslServerContext); | 241 | | - | 242 | | - if (executorService != null) { | 243 | | - executorService.shutdown(); | 244 | | - } | 245 | 246 | } | 246 | 247 | } | 247 | 248 |
| |
Collapse file Copy file name to clipboardExpand all lines: handler/src/test/java/io/netty/handler/ssl/DelayingExecutor.java +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -41,7 +41,8 @@ public void execute(Runnable command) { | 41 | 41 | ThreadLocalRandom.current().nextInt(100), TimeUnit.MILLISECONDS); | 42 | 42 | } | 43 | 43 |
| 44 | | - void shutdown() { | | 44 | + boolean shutdownAndAwaitTermination(long timeout, TimeUnit unit) throws InterruptedException { | 45 | 45 | service.shutdown(); | | 46 | + return service.awaitTermination(timeout, unit); | 46 | 47 | } | 47 | 48 | } |
Collapse file Copy file name to clipboardExpand all lines: handler/src/test/java/io/netty/handler/ssl/OpenSslPrivateKeyMethodTest.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -114,10 +114,10 @@ public Thread newThread(Runnable r) { | 114 | 114 | } | 115 | 115 |
| 116 | 116 | @AfterAll | 117 | | - public static void destroy() { | | 117 | + public static void destroy() throws InterruptedException { | 118 | 118 | if (OpenSsl.isBoringSSL() || OpenSsl.isAWSLC()) { | 119 | 119 | GROUP.shutdownGracefully(); | 120 | | - EXECUTOR.shutdown(); | | 120 | + assertTrue(EXECUTOR.shutdownAndAwaitTermination(5, TimeUnit.SECONDS)); | 121 | 121 | } | 122 | 122 | } | 123 | 123 |
| |
Collapse file Copy file name to clipboardExpand all lines: handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -550,7 +550,7 @@ public void tearDown() throws InterruptedException { | 550 | 550 | if (clientGroupShutdownFuture != null) { | 551 | 551 | clientGroupShutdownFuture.sync(); | 552 | 552 | } | 553 | | - delegatingExecutor.shutdown(); | | 553 | + assertTrue(delegatingExecutor.shutdownAndAwaitTermination(5, TimeUnit.SECONDS)); | 554 | 554 | serverException = null; | 555 | 555 | clientException = null; | 556 | 556 | } | |
Collapse file Copy file name to clipboardExpand all lines: handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -994,7 +994,7 @@ public void testHandshakeWithExecutorJDK() throws Throwable { | 994 | 994 | try { | 995 | 995 | testHandshakeWithExecutor(executorService, SslProvider.JDK, false); | 996 | 996 | } finally { | 997 | | - executorService.shutdown(); | | 997 | + assertTrue(executorService.shutdownAndAwaitTermination(5, TimeUnit.SECONDS)); | 998 | 998 | } | 999 | 999 | } | 1000 | 1000 |
| @@ -1023,7 +1023,7 @@ public void testHandshakeWithExecutorOpenSsl() throws Throwable { | 1023 | 1023 | try { | 1024 | 1024 | testHandshakeWithExecutor(executorService, SslProvider.OPENSSL, false); | 1025 | 1025 | } finally { | 1026 | | - executorService.shutdown(); | | 1026 | + assertTrue(executorService.shutdownAndAwaitTermination(5, TimeUnit.SECONDS)); | 1027 | 1027 | } | 1028 | 1028 | } | 1029 | 1029 |
| @@ -1048,7 +1048,7 @@ public void testHandshakeMTLSWithExecutorJDK() throws Throwable { | 1048 | 1048 | try { | 1049 | 1049 | testHandshakeWithExecutor(executorService, SslProvider.JDK, true); | 1050 | 1050 | } finally { | 1051 | | - executorService.shutdown(); | | 1051 | + assertTrue(executorService.shutdownAndAwaitTermination(5, TimeUnit.SECONDS)); | 1052 | 1052 | } | 1053 | 1053 | } | 1054 | 1054 |
| @@ -1077,7 +1077,7 @@ public void testHandshakeMTLSWithExecutorOpenSsl() throws Throwable { | 1077 | 1077 | try { | 1078 | 1078 | testHandshakeWithExecutor(executorService, SslProvider.OPENSSL, true); | 1079 | 1079 | } finally { | 1080 | | - executorService.shutdown(); | | 1080 | + assertTrue(executorService.shutdownAndAwaitTermination(5, TimeUnit.SECONDS)); | 1081 | 1081 | } | 1082 | 1082 | } | 1083 | 1083 |
| |
Collapse file Copy file name to clipboardExpand all lines: testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslClientRenegotiateTest.java +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -206,6 +206,7 @@ public void initChannel(Channel sch) throws Exception { | 206 | 206 | } finally { | 207 | 207 | if (executorService != null) { | 208 | 208 | executorService.shutdown(); | | 209 | + assertTrue(executorService.awaitTermination(5, TimeUnit.SECONDS)); | 209 | 210 | } | 210 | 211 | } | 211 | 212 | } | |
Collapse file Copy file name to clipboardExpand all lines: testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslEchoTest.java +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -385,6 +385,7 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { | 385 | 385 | clientChannel.close().awaitUninterruptibly(); | 386 | 386 | sc.close().awaitUninterruptibly(); | 387 | 387 | delegatedTaskExecutor.shutdown(); | | 388 | + assertTrue(delegatedTaskExecutor.awaitTermination(5, TimeUnit.SECONDS)); | 388 | 389 |
| 389 | 390 | if (serverException.get() != null && !(serverException.get() instanceof IOException)) { | 390 | 391 | throw serverException.get(); | |
Collapse file Copy file name to clipboardExpand all lines: testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslGreetingTest.java +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 58 | 58 |
| 59 | 59 | import static org.junit.jupiter.api.Assertions.assertEquals; | 60 | 60 | import static org.junit.jupiter.api.Assertions.assertFalse; | | 61 | +import static org.junit.jupiter.api.Assertions.assertTrue; | 61 | 62 | import static org.junit.jupiter.api.Assertions.fail; | 62 | 63 |
| 63 | 64 | public class SocketSslGreetingTest extends AbstractSocketTest { | @@ -183,6 +184,7 @@ public void initChannel(Channel sch) throws Exception { | 183 | 184 | } finally { | 184 | 185 | if (executorService != null) { | 185 | 186 | executorService.shutdown(); | | 187 | + assertTrue(executorService.awaitTermination(5, TimeUnit.SECONDS)); | 186 | 188 | } | 187 | 189 | } | 188 | 190 | } | |
Collapse file Copy file name to clipboardExpand all lines: transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -255,6 +255,7 @@ public void testHandshakeWithExecutor() throws Exception { | 255 | 255 | testHandshakeWithExecutor(executorService, "TLSv1.2"); | 256 | 256 | } finally { | 257 | 257 | executorService.shutdown(); | | 258 | + assertTrue(executorService.awaitTermination(5, TimeUnit.SECONDS)); | 258 | 259 | } | 259 | 260 | } | 260 | 261 |
| @@ -266,6 +267,7 @@ public void testHandshakeWithExecutorTLSv13() throws Exception { | 266 | 267 | testHandshakeWithExecutor(executorService, "TLSv1.3"); | 267 | 268 | } finally { | 268 | 269 | executorService.shutdown(); | | 270 | + assertTrue(executorService.awaitTermination(5, TimeUnit.SECONDS)); | 269 | 271 | } | 270 | 272 | } | 271 | 273 |
| |
|