Skip to content

Commit 7cd871a

Browse files
authored
DATAES-870 - Workaround for reactor-netty error.
Original PR: spring-projects#484
1 parent d428db7 commit 7cd871a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/org/springframework/data/elasticsearch/client/reactive/DefaultReactiveElasticsearchClient.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,11 @@ private static WebClientProvider getWebClientProvider(ClientConfiguration client
239239
Duration connectTimeout = clientConfiguration.getConnectTimeout();
240240
Duration soTimeout = clientConfiguration.getSocketTimeout();
241241

242-
HttpClient httpClient = HttpClient.create();
242+
// DATAES-870: previously: HttpClient httpClient = HttpClient.create();
243+
// disable pooling of connections (see https://github.com/spring-projects/spring-framework/issues/22464)
244+
// otherwise we get errors: "Connection prematurely closed BEFORE response; nested exception is
245+
// java.lang.RuntimeException: Connection prematurely closed BEFORE response"
246+
HttpClient httpClient = HttpClient.newConnection().compress(true);
243247

244248
if (!connectTimeout.isNegative()) {
245249
httpClient = httpClient.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, Math.toIntExact(connectTimeout.toMillis()));

0 commit comments

Comments
 (0)