# Default connection timeout of Java client (actually MissingRequiredPropertyException for method /nodes/info)

**URL:** <https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [August 5, 2024, 11:50am UTC](https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377 "2024-08-05T11:50:43Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexey\_Melnikov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexey_melnikov/32/23060_2.png) [@Alexey\_Melnikov](https://discuss.elastic.co/u/Alexey_Melnikov)\
**Post date:** [August 5, 2024, 11:50am UTC](https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377/1 "2024-08-05T11:50:43Z")

</div>

Hello!  
I recently updated project dependency of project from `co.elastic.clients:elasticsearch-java:7.17.22` to `co.elastic.clients:elasticsearch-java:8.14.3`

Everything seems working fine first hour.  
After an hour exactly client not able to communicate with server.

Before I had singleton client object created via:

```auto
client = RestClient.builder(
      new HttpHost("localhost", 9200, "http"))
    ).setRequestConfigCallback(requestConfigBuilder -> {
      requestConfigBuilder.setConnectTimeout(2_000);
      requestConfigBuilder.setSocketTimeout(90_000);
      return requestConfigBuilder;
    }).build();

```

And it was shared between multiple threads for reading data.

In background I had daemon thread which were checking available nodes every hour

```auto
client.nodes().info().nodes().values();

```

In version 7 it worked fine during off hours, and connection kept alive by java client.

In version 8 seems client or something underneath is closing connection earlier. No warning messages in the logs.

I didn't find anything related in release notes. What should be changed? What timeout value? Or maybe I need to refresh somehow client session? Or client object can't be singleton and should be instantiated with every request?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 5, 2024, 12:53pm UTC](https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377/2 "2024-08-05T12:53:08Z")

</div>

I'd increase the frequency of your daemon thread or I'd use [the sniffer](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/_usage.html).

Not sure if something changed in the low level client though.

---

<div class="post-metadata">

**Author:** ![Alexey\_Melnikov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexey_melnikov/32/23060_2.png) [@Alexey\_Melnikov](https://discuss.elastic.co/u/Alexey_Melnikov)\
**Post date:** [August 5, 2024, 2:24pm UTC](https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377/3 "2024-08-05T14:24:06Z")

</div>

I seems found reason: [Enable TCP keepalives by default in Java REST clients · Issue #65213 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues/65213)

---

<div class="post-metadata">

**Author:** ![Alexey\_Melnikov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexey_melnikov/32/23060_2.png) [@Alexey\_Melnikov](https://discuss.elastic.co/u/Alexey_Melnikov)\
**Post date:** [August 5, 2024, 7:16pm UTC](https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377/4 "2024-08-05T19:16:24Z")

</div>

Dumb me, didn't notice incorrect level of logging exceptions.

Actually connections were working fine in my case.

This is problem of calling `client.nodes().info()`, it throws exception:

```auto
co.elastic.clients.transport.TransportException: node: http://127.0.0.1:9200/, status: 200, [es/nodes.info] Failed to decode response
	at co.elastic.clients.transport.ElasticsearchTransportBase.decodeTransportResponse(ElasticsearchTransportBase.java:404)
	at co.elastic.clients.transport.ElasticsearchTransportBase.getApiResponse(ElasticsearchTransportBase.java:363)
	at co.elastic.clients.transport.ElasticsearchTransportBase.performRequest(ElasticsearchTransportBase.java:147)
	at co.elastic.clients.elasticsearch.nodes.ElasticsearchNodesClient.info(ElasticsearchNodesClient.java:229)
	at com.termweb4.core.module.search.SearchModuleConfiguration$1.call(SearchModuleConfiguration.java:104)
	at com.termweb4.core.module.search.SearchModuleConfiguration$1.call(SearchModuleConfiguration.java:95)
	at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
	at java.util.concurrent.FutureTask.run(FutureTask.java)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)
Caused by: co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.nodes.info.NodeInfoXpack: co.elastic.clients.util.MissingRequiredPropertyException: Missing required property 'NodeInfoXpackSecurity.http' (JSON path: nodes.LnKzJ51QQlKmJ4tNcWOO5Q.settings.xpack.security) (line no=1, column no=1508, offset=-1)
	at co.elastic.clients.json.JsonpMappingException.from0(JsonpMappingException.java:134)
	at co.elastic.clients.json.JsonpMappingException.from(JsonpMappingException.java:121)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:218)

```

I'm trying to connect to elasticsearch 7.17.22 with 8.14.3 client on my localhost with disabled xpack.security.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 5, 2024, 7:42pm UTC](https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377/5 "2024-08-05T19:42:03Z")

</div>

Use the same version for both client and server.

---

<div class="post-metadata">

**Author:** ![Alexey\_Melnikov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexey_melnikov/32/23060_2.png) [@Alexey\_Melnikov](https://discuss.elastic.co/u/Alexey_Melnikov)\
**Post date:** [August 5, 2024, 7:58pm UTC](https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377/6 "2024-08-05T19:58:07Z")

</div>

Yep, I was going to write that same problem occurred with 7.17.23 client too.  
Method `co.elastic.clients.elasticsearch.nodes.ElasticsearchNodesClient#info()` of `co.elastic.clients.elasticsearch.ElasticsearchClient#nodes` throws this exception.

I switched to use another method for now: `co.elastic.clients.elasticsearch.ElasticsearchClient#info`

PS: with different server version and client I was checking this statement from documentation: [Elasticsearch language clients are only backwards compatible with default distributions and without guarantees made.](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/8.14/introduction.html#:~:text=Elasticsearch%20language%20clients%20are%20only%20backwards%20compatible%20with%20default%20distributions%20and%20without%20guarantees%20made.)

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 5, 2024, 9:06pm UTC](https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377/7 "2024-08-05T21:06:59Z")

</div>

What is the output of

```
mvn dependency:tree

```

?

---

<div class="post-metadata">

**Author:** ![Alexey\_Melnikov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexey_melnikov/32/23060_2.png) [@Alexey\_Melnikov](https://discuss.elastic.co/u/Alexey_Melnikov)\
**Post date:** [August 5, 2024, 9:14pm UTC](https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377/8 "2024-08-05T21:14:04Z")

</div>

Dependency tree is huge and I'm not allowed to disclose it.  
But I'm pretty sure, here I'm using correct versions, this is what I got right now, for client:

```shell
+--- co.elastic.clients:elasticsearch-java:8.14.3
| +--- org.elasticsearch.client:elasticsearch-rest-client:8.14.3
| | +--- org.apache.httpcomponents:httpclient:4.5.14
| | +--- org.apache.httpcomponents:httpcore:4.4.13
| | +--- org.apache.httpcomponents:httpasyncclient:4.1.5
| | +--- org.apache.httpcomponents:httpcore-nio:4.4.13
| | +--- commons-codec:commons-codec:1.15
| | \--- commons-logging:commons-logging:1.2
| +--- com.google.code.findbugs:jsr305:3.0.2
| +--- jakarta.json:jakarta.json-api:2.0.1 -> 2.0.2
| \--- org.eclipse.parsson:parsson:1.0.5
| \--- jakarta.json:jakarta.json-api:2.0.2
+--- jakarta.json:jakarta.json-api:2.0.1 -> 2.0.2

```

Anyway, problem happened before update to v8 client.

Before I did minor update of client from v7.17.17 to v7.17.23. And this brought problems to `client.nodes().info()` I just missed it because of wrong log level of application.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 5, 2024, 10:31pm UTC](https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377/9 "2024-08-05T22:31:38Z")

</div>

Have a look at [this page](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/missing-required-property.html). Could you try the workaround?

---

<div class="post-metadata">

**Author:** ![Alexey\_Melnikov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexey_melnikov/32/23060_2.png) [@Alexey\_Melnikov](https://discuss.elastic.co/u/Alexey_Melnikov)\
**Post date:** [August 6, 2024, 6:59am UTC](https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377/10 "2024-08-06T06:59:39Z")

</div>

Yes, I already tried that, it bypassed first error with mapping 'NodeInfoXpackSecurity.http', but then it failed on another field, because JSON contained array value but it expected an object.

I can try later create test repo with this error.

As I said before, replacing call `client.nodes.info()` with `client.info()` solved issue, we were simply checking connectivity to cluster with this method.

Thanks for your time David.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 6, 2024, 8:13am UTC](https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377/11 "2024-08-06T08:13:40Z")

</div>

Great. But could you open an issue in [GitHub - elastic/elasticsearch-java: Official Elasticsearch Java Client](https://github.com/elastic/elasticsearch-java)?

I'm sure that @ltrotta will be happy to check and fix 😊

Thanks for reporting!

---

<div class="post-metadata">

**Author:** ![ltrotta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ltrotta/32/124003_2.png) [@ltrotta](https://discuss.elastic.co/u/ltrotta)\
**Post date:** [August 6, 2024, 9:04am UTC](https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377/12 "2024-08-06T09:04:03Z")

</div>

Hello! I can confirm that `client.nodes.info()` is currently broken for 7.17.X versions, probably due to changes server side that were not ported to the clients. We'll fix it in newer 7.17 releases, while for 8.14.X it seems to be working correctly. Thank you for reporting this! You can still open an issue in the client repo, it helps us with tracking 🙂

---

<div class="post-metadata">

**Author:** ![Alexey\_Melnikov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexey_melnikov/32/23060_2.png) [@Alexey\_Melnikov](https://discuss.elastic.co/u/Alexey_Melnikov)\
**Post date:** [August 6, 2024, 9:28am UTC](https://discuss.elastic.co/t/default-connection-timeout-of-java-client-actually-missingrequiredpropertyexception-for-method-nodes-info/364377/13 "2024-08-06T09:28:04Z")

</div>

Here we go: [Client throws MissingRequiredPropertyException for method /nodes/info · Issue #855 · elastic/elasticsearch-java · GitHub](https://github.com/elastic/elasticsearch-java/issues/855)
