forked fromAsyncHttpClient/async-http-client
- Notifications
You must be signed in to change notification settings - Fork0
Commit2fd2d86
committed
Fix RejectedExecutionException when using DnsAddressResolverGroup,closeAsyncHttpClient#1335
Motivation:AddressResolverGroup adds a listener to the termination future of anEventExecutor when a new AddressResolver is created. The listener callsAddressResolver.close() when the EventExecutor is terminated to give theAddressResolver a chance to release its resources.When using DnsAddressResolverGroup, the AddressResolver.close() willeventually trigger DnsNameResolver.close(), which closes its underlyingDatagramChannel.DatagramChannel.close() (or any Channel.close()) will travel throughpipeline and trigger EventExecutor.execute() becauseDnsNameResolver.close() has been invoked from a non-I/O thread.(NB: A terminationFuture is always notified from the GlobalEventExecutorthread.)However, because we are doing this in the listener of the terminationfuture of the terminated EventLoop we are trying to execute a task upon,the attempt to close the channel fails due toRejectedExecutionException.Modifications:- Do not call Channel.close() in DnsNameResolver.close() if the Channel has been closed by EventLoop alreadyResult:No more RejectedExecutionException when shutting down an event loop.1 parentae4929a commit2fd2d86
File tree
1 file changed
+3
-1
lines changed- netty-bp/resolver-dns/src/main/java/io/netty/resolver/dns
1 file changed
+3
-1
lines changedLines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
310 | 312 | | |
311 | 313 | | |
312 | 314 | | |
| |||
0 commit comments
Comments
(0)