netty5/transport-native-epoll/src/main/java/io/netty/channel/epoll
Julien Viet f85583047e KQueueEventLoop | EpollEventLoop may incorrectly update registration when FD is reused.
Motivation:

The current KQueueEventLoop implementation does not process concurrent domain socket channel registration/unregistration in the order they actual
happen since unregistration are delated by an event loop task scheduling. When a domain socket is closed, it's file descriptor might be reused
quickly and therefore trigger a new channel registration using the same descriptor.

Consequently the KQueueEventLoop#add(AbstractKQueueChannel) method will overwrite the current inactive channels having the same descriptor
and the delayed KQueueEventLoop#remove(AbstractKQueueChannel) will remove the active channel that replaced the inactive one.

As active channels are registered, events for this file descriptor won't be processed anymore and the channels will never be closed.

The same problem can also happen in EpollEventLoop. Beside this we also may never remove the AbstractEpollChannel from the internal map
when it is unregistered which will prevent it from be GC'ed

Modifications:

- Change logic of native KQueue and Epoll implementations to ensure we correctly handle the case of FD reuse
- Only try to update kevent / epoll if the Channel is still open (as otherwise it will be handled by kqueue / epoll itself)
- Correctly remove AbstractEpollChannel from internal map in all cases
- Make implementation of closeAll() consistent for Epoll and KQueueEventLoop

Result:

KQueue and Epoll native transports correctly handle FD reuse

Co-authored-by: Norman Maurer <norman_maurer@apple.com>
2019-05-22 10:11:42 +02:00
..
AbstractEpollChannel.java Only use static Exception instances when we can ensure addSuppressed … (#9152) 2019-05-17 22:42:53 +02:00
AbstractEpollServerChannel.java migrate java8: use requireNonNull (#8840) 2019-02-04 10:32:25 +01:00
AbstractEpollStreamChannel.java Only use static Exception instances when we can ensure addSuppressed … (#9152) 2019-05-17 22:42:53 +02:00
Epoll.java Allow to use native transports when sun.misc.Unsafe is not present on… (#8231) 2018-08-29 19:36:33 +02:00
EpollChannelConfig.java migrate java8: use requireNonNull (#8840) 2019-02-04 10:32:25 +01:00
EpollChannelOption.java Allow to configure socket option SO_BUSY_POLL (#8268) 2018-09-07 20:50:51 +02:00
EpollDatagramChannel.java Revert "Added UDP multicast (with caveats: no ipv6, getInterface, getNetworkI… (#9006)" 2019-04-12 21:33:25 +02:00
EpollDatagramChannelConfig.java Revert "Added UDP multicast (with caveats: no ipv6, getInterface, getNetworkI… (#9006)" 2019-04-12 21:33:25 +02:00
EpollDomainSocketChannel.java Tighten contract between Channel and EventLoop by require the EventLoop on Channel construction. (#8587) 2019-01-14 20:11:13 +01:00
EpollDomainSocketChannelConfig.java Remove static wildcard imports in EpollDomainSocketChannelConfig (#9066) 2019-04-18 07:34:08 +02:00
EpollEventArray.java Allow to use native transports when sun.misc.Unsafe is not present on… (#8231) 2018-08-29 19:36:33 +02:00
EpollEventLoopGroup.java remove unused import statement (#8792) 2019-01-28 16:50:15 +01:00
EpollHandler.java KQueueEventLoop | EpollEventLoop may incorrectly update registration when FD is reused. 2019-05-22 10:11:42 +02:00
EpollMode.java Allow to change epoll mode 2015-02-04 21:37:34 +01:00
EpollRecvByteAllocatorHandle.java Have (Epoll|KQueue)RecvByteAllocatorHandle extend DelegatingHandle (#9060) 2019-04-16 09:21:43 +02:00
EpollRecvByteAllocatorStreamingHandle.java Update to new checkstyle plugin (#8777) 2019-01-24 16:24:19 +01:00
EpollRegistration.java Make it possible to use a wrapped EventLoop with a Channel (#8677) 2019-01-17 09:17:51 +01:00
EpollServerChannelConfig.java use checkPositive/checkPositiveOrZero (#8803) 2019-01-31 09:06:59 +01:00
EpollServerDomainSocketChannel.java Tighten contract between Channel and EventLoop by require the EventLoop on Channel construction. (#8587) 2019-01-14 20:11:13 +01:00
EpollServerSocketChannel.java Make it possible to use a wrapped EventLoop with a Channel (#8677) 2019-01-17 09:17:51 +01:00
EpollServerSocketChannelConfig.java Avoid repeating the same field and hiding it (#8335) 2018-09-28 17:37:14 +02:00
EpollSocketChannel.java Make it possible to use a wrapped EventLoop with a Channel (#8677) 2019-01-17 09:17:51 +01:00
EpollSocketChannelConfig.java Avoid repeating the same field and hiding it (#8335) 2018-09-28 17:37:14 +02:00
EpollTcpInfo.java Correctly handle unsigned int values returned from TCP_INFO 2017-07-25 16:18:52 +02:00
LinuxSocket.java Only use static Exception instances when we can ensure addSuppressed … (#9152) 2019-05-17 22:42:53 +02:00
Native.java Only use static Exception instances when we can ensure addSuppressed … (#9152) 2019-05-17 22:42:53 +02:00
NativeDatagramPacketArray.java Reduce direct memory overhead per EpollEventLoop when using EpollDatagramChannel (#8825) 2019-02-02 07:14:53 +01:00
NativeStaticallyReferencedJniMethods.java Native EPOLL Library Allows Shading 2016-02-03 14:40:28 -08:00
package-info.java Introduce a native transport for linux using epoll ET 2014-02-15 22:44:56 +01:00
TcpMd5Util.java migrate java8: use requireNonNull (#8840) 2019-02-04 10:32:25 +01:00