Skip to content

Commit

Permalink
[Test] Ignore closed connections on Windows hosts (elastic#108362)
Browse files Browse the repository at this point in the history
This commit adds special handling for the  `java.io.IOException: An established connection was aborted by the software in your host machine` in `Netty4HttpClient#exceptionCaught ` method. This exception only occurs when running tests on Windows hosts

Resolves: elastic#108193
  • Loading branch information
slobodanadamovic committed May 13, 2024
1 parent 6884002 commit 93ec9d6
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.elasticsearch.transport.netty4.NettyAllocator;

import java.io.Closeable;
import java.io.IOException;
import java.net.SocketAddress;
import java.net.SocketException;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -203,7 +204,11 @@ protected void channelRead0(ChannelHandlerContext ctx, HttpObject msg) {

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
if (cause instanceof PrematureChannelClosureException || cause instanceof SocketException) {
if (cause instanceof PrematureChannelClosureException
|| cause instanceof SocketException
|| (cause instanceof IOException
&& cause.getMessage() != null
&& cause.getMessage().contains("An established connection was aborted by the software in your host machine"))) {
// no more requests coming, so fast-forward the latch
fastForward();
} else {
Expand Down

0 comments on commit 93ec9d6

Please sign in to comment.