Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] jakarta.json.stream.JsonParsingException when reading stats of an index which contains more than 2GB data #299

Closed
luontola opened this issue Dec 14, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@luontola
Copy link

Describe the bug
org.opensearch.client.opensearch.indices.OpenSearchIndicesClient#stats crashes with jakarta.json.stream.JsonParsingException when trying to read the stats of an index with more than about 2GB data.

To Reproduce
Steps to reproduce the behavior:

  1. Write so much data to an index that its size_in_bytes in http://127.0.0.1:9200/_stats is more than 2147483647 bytes.
  2. Call org.opensearch.client.opensearch.indices.OpenSearchIndicesClient#stats to read the stats of that index.
  3. The client will throw the following exception:
jakarta.json.stream.JsonParsingException: Jackson exception: Numeric value (19411974757) out of range of int (-2147483648 - 2147483647)
 at [Source: (GZIPInputStream); line: 1, column: 144]
	at org.opensearch.client.json.jackson.JacksonJsonpParser.convertException(JacksonJsonpParser.java:97)
	at org.opensearch.client.json.jackson.JacksonJsonpParser.getInt(JacksonJsonpParser.java:168)
	at org.opensearch.client.json.JsonpDeserializerBase$2.deserialize(JsonpDeserializerBase.java:135)
	at org.opensearch.client.json.JsonpDeserializerBase$2.deserialize(JsonpDeserializerBase.java:129)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:88)
	at org.opensearch.client.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:85)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:189)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:150)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:88)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:92)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:56)
	at org.opensearch.client.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:85)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:189)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:150)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:88)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:92)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:56)
	at org.opensearch.client.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:85)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:189)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:150)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:88)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:92)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:56)
	at org.opensearch.client.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:85)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:189)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:150)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:88)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:92)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:56)
	at org.opensearch.client.transport.aws.AwsSdk2Transport.parseResponse(AwsSdk2Transport.java:486)
	at org.opensearch.client.transport.aws.AwsSdk2Transport.executeSync(AwsSdk2Transport.java:365)
	at org.opensearch.client.transport.aws.AwsSdk2Transport.performRequest(AwsSdk2Transport.java:171)
	at org.opensearch.client.opensearch.indices.OpenSearchIndicesClient.stats(OpenSearchIndicesClient.java:1525)
	at myapp.elasticsearch$get_index_stats.invokeStatic(elasticsearch.clj:389)
	at myapp.elasticsearch$get_index_stats.invoke(elasticsearch.clj:384)
	at myapp.elasticsearch$index_documents_BANG_$stats_task__8115.invoke(elasticsearch.clj:471)
	at myapp.pipeline$build_task$task__7926.invoke(pipeline.clj:152)
	at clojure.lang.AFn.call(AFn.java:18)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.fasterxml.jackson.core.exc.InputCoercionException: Numeric value (19411974757) out of range of int (-2147483648 - 2147483647)
 at [Source: (GZIPInputStream); line: 1, column: 144]
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportInputCoercion(ParserMinimalBase.java:637)
	at com.fasterxml.jackson.core.base.ParserMinimalBase.reportOverflowInt(ParserMinimalBase.java:606)
	at com.fasterxml.jackson.core.base.ParserBase.convertNumberToInt(ParserBase.java:979)
	at com.fasterxml.jackson.core.base.ParserBase._parseIntValue(ParserBase.java:887)
	at com.fasterxml.jackson.core.base.ParserBase.getIntValue(ParserBase.java:710)
	at org.opensearch.client.json.jackson.JacksonJsonpParser.getInt(JacksonJsonpParser.java:166)
	... 43 more

Expected behavior
The client returns the index stats without errors. All fields which relate to file sizes should use the long type instead of int. In addition to org.opensearch.client.opensearch._types.StoreStats#sizeInBytes there seem to be many other fields already in the same class with the same problem. The whole codebase should be reviewed to fix all instances of this bug.

Version:
org.opensearch.client/opensearch-java "2.1.0"
org.opensearch.client/opensearch-rest-client "2.4.0"

@luontola luontola added bug Something isn't working untriaged labels Dec 14, 2022
@anasalkouz anasalkouz transferred this issue from opensearch-project/OpenSearch Dec 20, 2022
@wbeckler
Copy link

This is a good catch. @luontola would you be up for proposing a PR for the opensearch-java client?

@wbeckler
Copy link

Also, if we fix this, would it potentially break any working code that relies on the int type in the created object?

@szczepanczykd
Copy link
Collaborator

Duplicate of: #184

@dblock
Copy link
Member

dblock commented May 21, 2023

Closing as dup.

@dblock dblock closed this as completed May 21, 2023
@oksanay
Copy link
Contributor

oksanay commented Feb 22, 2024

@dblock I don't know why it is closed as a dupe or not. We are still having the same exact issue in 2.8.4 version. Please advise what to do in this case

@dblock
Copy link
Member

dblock commented Feb 27, 2024

Looks like #877 fixed this, so 2.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants