Repository navigation
Conversation
1 task
SimpleChannelPool#close() blocks until idle connections are closed, so it must not run on an event loop. Complete the close promise on the event loop and close the underlying connection pool on the caller thread after the wait; when close() itself is called on an event loop, don't wait and close the connection pool on GlobalEventExecutor instead. Fixes aws#6863.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Fixes #6863.
Http2MultiplexedChannelPool#doClose()calledconnectionPool.close()inside a listener running on the close event loop.SimpleChannelPool#close()blocks onchannel.close().awaitUninterruptibly()for each idle connection, so when an idle connection belongs to that event loop and its close does not complete immediately (e.g. TLS close_notify), Netty throwsBlockingOperationException. The exception is swallowed,closeFinishedPromiseis never completed, andclose()fails after 10 seconds with "Event loop didn't close after 10 seconds."Modifications
Http2MultiplexedChannelPool: the event loop listener only completescloseFinishedPromiseonce all multiplexed connections are released.close()then callsconnectionPool.close()on the calling thread after the wait. Ifclose()itself runs on an event loop of the pool's group (asHttpOrHttp2ChannelPool#close()does), it does not wait and closes the connection pool onGlobalEventExecutoronce the release completes.connectionPool.close()onGlobalEventExecutorunconditionally was rejected:BetterFixedChannelPool#close0()already callsHttp2MultiplexedChannelPool#close()onGlobalEventExecutor, which then waits on itself (reproduced as a 10 second timeout inHttp2MultiplexedChannelPoolTest).Http2MultiplexedChannelPoolCloseTest(single-threadDefaultEventLoopGroup,LocalChannel, a realSimpleChannelPoolwith one idle connection whose close completes on the next loop iteration): close from a non event loop thread, and close from the event loop owning the idle connection. Both fail on master withBlockingOperationException.Testing
mvn -B install -pl http-clients/netty-nio-client(checkstyle and spotbugs enabled): BUILD SUCCESS; 470 tests, 0 failures, 0 errors, 1 skipped (JUnit 5) and 212 tests, 0 failures, 0 errors, 70 skipped (JUnit 4/TestNG).*ChannelPool*TestandNettyClientAlpnTestrun 5 times: all passed.Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License