Skip to content

Commit 5e03dd3

Browse files
retaDivyansh Sharma
authored andcommitted
An attempt to fix flaky SecureReactorNetty4HttpServerTransportTests (opensearch-project#18680)
Signed-off-by: Andriy Redko <[email protected]>
1 parent eff2fa2 commit 5e03dd3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

plugins/transport-reactor-netty4/src/main/java/org/opensearch/http/reactor/netty4/ReactorNetty4HttpServerTransport.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ protected HttpServerChannel bind(InetSocketAddress socketAddress) throws Excepti
243243
.runOn(sharedGroup.getLowLevelGroup())
244244
.bindAddress(() -> socketAddress)
245245
.compress(true)
246+
.http2Settings(spec -> spec.maxHeaderListSize(maxHeaderSize.bytesAsInt()))
246247
.httpRequestDecoder(
247248
spec -> spec.maxChunkSize(maxChunkSize.bytesAsInt())
248249
.h2cMaxContentLength(h2cMaxContentLength.bytesAsInt())

plugins/transport-reactor-netty4/src/test/java/org/opensearch/http/reactor/netty4/ReactorHttpClient.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.UncheckedIOException;
2626
import java.net.InetSocketAddress;
2727
import java.nio.charset.StandardCharsets;
28+
import java.time.Duration;
2829
import java.util.ArrayList;
2930
import java.util.Collection;
3031
import java.util.Collections;
@@ -56,6 +57,8 @@
5657
import reactor.netty.http.Http2SslContextSpec;
5758
import reactor.netty.http.HttpProtocol;
5859
import reactor.netty.http.client.HttpClient;
60+
import reactor.netty.http.client.PrematureCloseException;
61+
import reactor.util.retry.Retry;
5962

6063
import static io.netty.handler.codec.http.HttpHeaderNames.HOST;
6164
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
@@ -255,6 +258,7 @@ private FullHttpResponse sendRequestStream(
255258
)
256259
)
257260
)
261+
.retryWhen(Retry.backoff(3, Duration.ofSeconds(1)).filter(throwable -> throwable instanceof PrematureCloseException))
258262
.blockLast();
259263

260264
} finally {
@@ -283,7 +287,7 @@ private HttpClient createClient(final InetSocketAddress remoteAddress, final Nio
283287
.configure(s -> s.clientAuth(ClientAuth.NONE).trustManager(InsecureTrustManagerFactory.INSTANCE))
284288
: Http2SslContextSpec.forClient()
285289
.configure(s -> s.clientAuth(ClientAuth.NONE).trustManager(InsecureTrustManagerFactory.INSTANCE))
286-
)
290+
).handshakeTimeout(Duration.ofSeconds(30))
287291
);
288292
} else {
289293
return client.protocol(

0 commit comments

Comments
 (0)