(relevant - OpenSearch):
Describe: In porting to JDK 17 (error does not occur up thru JDK16), I am receiving a runtime outOfBoundsCheckFromIndexSize(oobef, fromIndex, size, length) exception from jdk.internal.util,Preconditions class. This only occurs once (initially) when creating a new index. The example OpenSearch code from the highlevelrest client below triggers the error on the low level client.
Configuration: OpenSearch 2.6, SprintBootStarterWeb 3.0.6 (occurs on 2.x versions as well) - JDK17 and above
Example Code:
lowLevelRestClient = restClient.getLowLevelClient();
NodesSniffer nodesniffer = new OpenSearchNodesSniffer(
lowLevelRestClient,
TimeUnit.SECONDS.toMillis(5),
OpenSearchNodesSniffer.Scheme.HTTPS);
Sniffer sniffer = Sniffer.builder(lowLevelRestClient)
.setNodesSniffer(nodesniffer)
.build();
SniffOnFailureListener listener = new SniffOnFailureListener();
listener.setSniffer(sniffer);
CreateIndexRequest createIndexRequest = new CreateIndexRequest(“test-my”);
createIndexRequest.settings(Settings.builder()
.put(“index.number_of_shards”, 1)
.put(“index.number_of_replicas”, 0)
);
try {
HashMap<String, String> typeMapping = new HashMap<String, String>();
typeMapping.put("type", "integer");
HashMap<String, Object> ageMapping = new HashMap<String, Object>();
ageMapping.put("age", typeMapping);
HashMap<String, Object> mapping = new HashMap<String, Object>();
mapping.put("properties", ageMapping);
createIndexRequest.mapping(mapping);
CreateIndexResponse createIndexResponse = restClient.indices().create(createIndexRequest, RequestOptions.DEFAULT);
System.out.println("\nCreating index:");
System.out.println("Is client acknowledged?" + ((createIndexResponse.isAcknowledged()) ? " Yes" : " No"));
} catch (Exception e) {
System.out.println(e.getMessage());
}
We can work around this problem, so its not a high priority for us. Planning to convert to Java Client at 3.0 release.
Thanks