GeezerVison is showing github.com — Await termination of SslHandler executor (#16138) (#16141) · netty/netty@1155c46
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 |
|---|
@@ -546,7 +546,7 @@ public void tearDown() throws InterruptedException { | 546 | 546 | if (clientGroupShutdownFuture != null) { | 547 | 547 | clientGroupShutdownFuture.sync(); | 548 | 548 | } | 549 | | - delegatingExecutor.shutdown(); | | 549 | + assertTrue(delegatingExecutor.shutdownAndAwaitTermination(5, TimeUnit.SECONDS)); | 550 | 550 | serverException = null; | 551 | 551 | clientException = null; | 552 | 552 | } | |
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 |
|---|
@@ -995,7 +995,7 @@ public void testHandshakeWithExecutorJDK() throws Throwable { | 995 | 995 | try { | 996 | 996 | testHandshakeWithExecutor(executorService, SslProvider.JDK, false); | 997 | 997 | } finally { | 998 | | - executorService.shutdown(); | | 998 | + assertTrue(executorService.shutdownAndAwaitTermination(5, TimeUnit.SECONDS)); | 999 | 999 | } | 1000 | 1000 | } | 1001 | 1001 |
| @@ -1024,7 +1024,7 @@ public void testHandshakeWithExecutorOpenSsl() throws Throwable { | 1024 | 1024 | try { | 1025 | 1025 | testHandshakeWithExecutor(executorService, SslProvider.OPENSSL, false); | 1026 | 1026 | } finally { | 1027 | | - executorService.shutdown(); | | 1027 | + assertTrue(executorService.shutdownAndAwaitTermination(5, TimeUnit.SECONDS)); | 1028 | 1028 | } | 1029 | 1029 | } | 1030 | 1030 |
| @@ -1049,7 +1049,7 @@ public void testHandshakeMTLSWithExecutorJDK() throws Throwable { | 1049 | 1049 | try { | 1050 | 1050 | testHandshakeWithExecutor(executorService, SslProvider.JDK, true); | 1051 | 1051 | } finally { | 1052 | | - executorService.shutdown(); | | 1052 | + assertTrue(executorService.shutdownAndAwaitTermination(5, TimeUnit.SECONDS)); | 1053 | 1053 | } | 1054 | 1054 | } | 1055 | 1055 |
| @@ -1078,7 +1078,7 @@ public void testHandshakeMTLSWithExecutorOpenSsl() throws Throwable { | 1078 | 1078 | try { | 1079 | 1079 | testHandshakeWithExecutor(executorService, SslProvider.OPENSSL, true); | 1080 | 1080 | } finally { | 1081 | | - executorService.shutdown(); | | 1081 | + assertTrue(executorService.shutdownAndAwaitTermination(5, TimeUnit.SECONDS)); | 1082 | 1082 | } | 1083 | 1083 | } | 1084 | 1084 |
| |
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 |
|---|
@@ -205,6 +205,7 @@ public void initChannel(Channel sch) throws Exception { | 205 | 205 | } finally { | 206 | 206 | if (executorService != null) { | 207 | 207 | executorService.shutdown(); | | 208 | + assertTrue(executorService.awaitTermination(5, TimeUnit.SECONDS)); | 208 | 209 | } | 209 | 210 | } | 210 | 211 | } | |
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 |
|---|
@@ -383,6 +383,7 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { | 383 | 383 | clientChannel.close().awaitUninterruptibly(); | 384 | 384 | sc.close().awaitUninterruptibly(); | 385 | 385 | delegatedTaskExecutor.shutdown(); | | 386 | + assertTrue(delegatedTaskExecutor.awaitTermination(5, TimeUnit.SECONDS)); | 386 | 387 |
| 387 | 388 | if (serverException.get() != null && !(serverException.get() instanceof IOException)) { | 388 | 389 | 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 |
|---|
@@ -253,6 +253,7 @@ public void testHandshakeWithExecutor() throws Exception { | 253 | 253 | testHandshakeWithExecutor(executorService, "TLSv1.2"); | 254 | 254 | } finally { | 255 | 255 | executorService.shutdown(); | | 256 | + assertTrue(executorService.awaitTermination(5, TimeUnit.SECONDS)); | 256 | 257 | } | 257 | 258 | } | 258 | 259 |
| @@ -264,6 +265,7 @@ public void testHandshakeWithExecutorTLSv13() throws Exception { | 264 | 265 | testHandshakeWithExecutor(executorService, "TLSv1.3"); | 265 | 266 | } finally { | 266 | 267 | executorService.shutdown(); | | 268 | + assertTrue(executorService.awaitTermination(5, TimeUnit.SECONDS)); | 267 | 269 | } | 268 | 270 | } | 269 | 271 |
| |
|