Elasticsearch `availableProcessors is already set` error when using Testcontainers netty transport
See original GitHub issueSo far I’ve only seen this affect our internal tests. On one of my machines I consistently get this failure:
Gradle Test Executor 5 > org.testcontainers.elasticsearch.ElasticsearchContainerTest > transportClientClusterHealth FAILED
java.lang.IllegalStateException: availableProcessors is already set to [4], rejecting [4]
at io.netty.util.NettyRuntime$AvailableProcessorsHolder.setAvailableProcessors(NettyRuntime.java:51)
at io.netty.util.NettyRuntime.setAvailableProcessors(NettyRuntime.java:87)
at org.elasticsearch.transport.netty4.Netty4Utils.setAvailableProcessors(Netty4Utils.java:83)
at org.elasticsearch.transport.netty4.Netty4Transport.<init>(Netty4Transport.java:112)
at org.elasticsearch.transport.Netty4Plugin.lambda$getTransports$0(Netty4Plugin.java:86)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:189)
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:283)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:128)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:114)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:104)
at org.testcontainers.elasticsearch.ElasticsearchContainerTest.transportClientClusterHealth(ElasticsearchContainerTest.java:103)
I believe this is an instance of a known Elasticsearch client issue (https://github.com/elastic/elasticsearch/issues/25741). This will be arising because both Elasticsearch and docker-java can use netty.
It is heavily mitigated by okhttp being our default transport now, but this bug does mean that we can’t test the netty transport any more.
We should probably either:
- Wait for https://github.com/elastic/elasticsearch/issues/25741 to be resolved more elegantly (I agree with https://github.com/elastic/elasticsearch/issues/25741#issuecomment-430063966, but I’m not sure if it will be resolved that way)
- Modify our tests to set the workaround system property
- Modify the
ElasticsearchContainer
class to automatically set the workaround system property
@dadoonet you might have a better understanding of this - do you have any suggestions?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
availableProcessors is already set to [12], rejecting [12]
setProperty("es.set.netty.runtime.available.processors", "false"); to the function main.
Read more >Elasticsearch `availableProcessors is already set` error when using ...
Elasticsearch `availableProcessors is already set` error when using Testcontainers netty transport.
Read more >Elasticsearch 5.4.1 - availableProcessors is already set
Hi, I have upgraded elasticsearch from 5.4.0 to 5.4.1 and I have got this error: java.lang.IllegalStateException: availableProcessors is ...
Read more >Elasticsearch container - Testcontainers for Java
This module helps running elasticsearch using Testcontainers. ... need to change cluster.name setting or set client.transport.ignore_cluster_name to true .
Read more >Table of Contents - Micronaut Documentation
Micronaut Security 3.4.1 responds with an error when an authenticated user ... The Netty access logger now supports excluding requests based on a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You have my respect that you have taken the effort to remove completely the dependency of Netty transport!
Thank you people!
Since 1.11.0, we no longer include Netty transport and fully migrated to OkHttp. I’m closing this issue as not relevant anymore 😃