Skip to content

Commit b6033d7

Browse files
committed
Handle Boostrap crash, close AsyncHttpClient#1190
1 parent c6c1a40 commit b6033d7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

client/src/main/java/org/asynchttpclient/netty/request/NettyChannelConnector.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.net.InetAddress;
2222
import java.net.InetSocketAddress;
2323
import java.util.List;
24-
import java.util.concurrent.RejectedExecutionException;
2524
import java.util.concurrent.atomic.AtomicBoolean;
2625

2726
import org.asynchttpclient.AsyncHandler;
@@ -31,8 +30,12 @@
3130
import org.asynchttpclient.netty.channel.Channels;
3231
import org.asynchttpclient.netty.channel.NettyConnectListener;
3332
import org.asynchttpclient.netty.timeout.TimeoutsHolder;
33+
import org.slf4j.Logger;
34+
import org.slf4j.LoggerFactory;
3435

3536
public class NettyChannelConnector {
37+
38+
private static final Logger LOGGER = LoggerFactory.getLogger(NettyChannelConnector.class);
3639

3740
private final AsyncHandlerExtensions asyncHandlerExtensions;
3841
private final InetSocketAddress localAddress;
@@ -69,11 +72,12 @@ public void connect(final Bootstrap bootstrap, final NettyConnectListener<?> con
6972

7073
try {
7174
connect0(bootstrap, connectListener, remoteAddress);
72-
} catch (RejectedExecutionException e) {
75+
} catch (Throwable e) {
76+
// workaround for https://github.com/netty/netty/issues/5387
7377
if (closed.get()) {
7478
connectListener.onFailure(null, e);
7579
} else {
76-
throw e;
80+
LOGGER.info("Connect crash but engine is shutting down");
7781
}
7882
}
7983
}

0 commit comments

Comments
 (0)