netty5/transport-native-kqueue/src/test/java/io/netty/channel/kqueue
Nick Hill 170e4deee6 Fix event loop shutdown timing fragility (#9616)
Motivation

The current event loop shutdown logic is quite fragile and in the
epoll/NIO cases relies on the default 1 second wait/select timeout that
applies when there are no scheduled tasks. Without this default timeout
the shutdown would hang indefinitely.

The timeout only takes effect in this case because queued scheduled
tasks are first cancelled in
SingleThreadEventExecutor#confirmShutdown(), but I _think_ even this
isn't robust, since the main task queue is subsequently serviced which
could result in some new scheduled task being queued with much later
deadline.

It also means shutdowns are unnecessarily delayed by up to 1 second.

Modifications

- Add/extend unit tests to expose the issue
- Adjust SingleThreadEventExecutor shutdown and confirmShutdown methods
to explicitly add no-op tasks to the taskQueue so that the subsequent
event loop iteration doesn't enter blocking wait (as looks like was
originally intended)

Results

Faster and more robust shutdown of event loops, allows removal of the
default wait timeout
2019-10-07 11:06:01 +04:00
..
KQueueAbstractDomainSocketEchoTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueChannelConfigTest.java Fix assertion error when closing / shutdown native channel and SO_LINGER is set. 2017-09-18 14:46:37 -07:00
KQueueCompositeBufferGatheringWriteTest.java IovArray#add return value resulted in more ByteBufs being added during iteration 2018-01-04 08:04:32 -08:00
KQueueDatagramConnectNotExistsTest.java Correctly handle connect/disconnect in EpollDatagramChannel / KQueueDatagramChannel 2017-08-04 09:22:53 +02:00
KQueueDatagramUnicastIPv6MappedTest.java Correctly handle IPV6-mapped-IPV4 addresses in native code when receiving datagrams (#9560) 2019-09-11 20:30:28 +02:00
KQueueDatagramUnicastIPv6Test.java Correctly handle IPV6-mapped-IPV4 addresses in native code when receiving datagrams (#9560) 2019-09-11 20:30:28 +02:00
KQueueDatagramUnicastTest.java Add IPv6 multicast test to testsuite (#9037) 2019-04-12 12:29:08 +02:00
KQueueDetectPeerCloseWithoutReadTest.java KQueue detect peer close without EVFILT_READ 2017-08-18 11:00:18 -07:00
KQueueDomainSocketDataReadInitialStateTest.java Epoll and Kqueue shouldn't read by default (#8024) 2018-06-15 10:28:50 +02:00
KQueueDomainSocketEchoTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueDomainSocketFdTest.java Update tests to not use TestUtils.getFreePort() and so ensure we not try to use a port that is used by the system in the meantime. 2017-07-20 08:25:37 +02:00
KQueueDomainSocketFileRegionTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueDomainSocketFixedLengthEchoTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueDomainSocketGatheringWriteTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueDomainSocketObjectEchoTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueDomainSocketReuseFdTest.java KQueueEventLoop | EpollEventLoop may incorrectly update registration when FD is reused. 2019-05-22 09:23:09 +02:00
KQueueDomainSocketShutdownOutputByPeerTest.java Support ALLOW_HALF_CLOSURE channel option on Unix domain socket. (#8932) 2019-03-19 11:24:07 +01:00
KQueueDomainSocketSslClientRenegotiateTest.java Support using an Executor to offload blocking / long-running tasks wh… (#8847) 2019-02-11 09:47:44 +01:00
KQueueDomainSocketSslEchoTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueDomainSocketSslGreetingTest.java Support using an Executor to offload blocking / long-running tasks wh… (#8847) 2019-02-11 09:47:44 +01:00
KQueueDomainSocketStartTlsTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueDomainSocketStringEchoTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueETSocketAutoReadTest.java remove unused imports (#9287) 2019-06-26 21:08:31 +02:00
KQueueETSocketConditionalWritabilityTest.java Epoll flush/writabilityChange deadlock 2018-02-20 11:40:58 +01:00
KQueueETSocketDataReadInitialStateTest.java Epoll and Kqueue shouldn't read by default (#8024) 2018-06-15 10:28:50 +02:00
KQueueETSocketExceptionHandlingTest.java remove unused imports (#9287) 2019-06-26 21:08:31 +02:00
KQueueETSocketHalfClosedTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueETSocketReadPendingTest.java remove unused imports (#9287) 2019-06-26 21:08:31 +02:00
KQueueEventLoopTest.java Fix event loop shutdown timing fragility (#9616) 2019-10-07 11:06:01 +04:00
KQueueRcvAllocatorOverrideSocketSslEchoTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueServerSocketChannelConfigTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketChannelConfigTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketChannelNotYetConnectedTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketCloseForciblyTest.java Only try to deregister from EventLoop when the native Channel was registered before. 2017-05-24 13:19:18 +02:00
KQueueSocketConnectionAttemptTest.java remove unused imports (#9287) 2019-06-26 21:08:31 +02:00
KQueueSocketConnectTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketEchoTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketFileRegionTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketFixedLengthEchoTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketGatheringWriteTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketMultipleConnectTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketObjectEchoTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketRstTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketShutdownOutputByPeerTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketShutdownOutputBySelfTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketSslClientRenegotiateTest.java Support using an Executor to offload blocking / long-running tasks wh… (#8847) 2019-02-11 09:47:44 +01:00
KQueueSocketSslEchoTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketSslGreetingTest.java Support using an Executor to offload blocking / long-running tasks wh… (#8847) 2019-02-11 09:47:44 +01:00
KQueueSocketSslSessionReuseTest.java Add more tests to KQueue and Epoll testsuites. (#8851) 2019-02-08 20:08:34 +01:00
KQueueSocketStartTlsTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketStringEchoTest.java New native transport for kqueue 2017-05-03 09:53:22 -07:00
KQueueSocketTest.java Resolve the pid field in PeerCredentials of KQueueDomainSocketChannels. (#9219) 2019-06-04 05:15:42 -07:00
KQueueSocketTestPermutation.java Add IPv6 multicast test to testsuite (#9037) 2019-04-12 12:29:08 +02:00
KqueueWriteBeforeRegisteredTest.java Add more tests to KQueue and Epoll testsuites. (#8851) 2019-02-08 20:08:34 +01:00