e348bd9217
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> |
||
---|---|---|
.. | ||
src | ||
pom.xml |