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] Require an optional JvmInfo Field #1040

Open
Bzil opened this issue Jun 20, 2024 · 3 comments
Open

[BUG] Require an optional JvmInfo Field #1040

Bzil opened this issue Jun 20, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Bzil
Copy link

Bzil commented Jun 20, 2024

What is the bug?

In class NodeJvmInfo at row 94 the field usingBundledJdk is expected as not null but in server side code, this field is nullable https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/monitor/jvm/JvmInfo.java#L235 https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/monitor/jvm/JvmInfo.java#L310

How can one reproduce the bug?

Call _nodes
See if you got response with jvm field like that :

"jvm": {
        "pid": 61,
        "version": "17.0.9",
        "vm_name": "OpenJDK 64-Bit Server VM",
        "vm_version": "17.0.9+9",
        "vm_vendor": "Red Hat, Inc.",
        "bundled_jdk": false,
        "using_bundled_jdk": null,
        "start_time_in_millis": 1713767662129,
        "mem": {
          "heap_init_in_bytes": 3183476736,
          "heap_max_in_bytes": 3183476736,
          "non_heap_init_in_bytes": 7667712,
          "non_heap_max_in_bytes": 0,
          "direct_max_in_bytes": 0
        },
        "gc_collectors": [
          "G1 Young Generation",
          "G1 Old Generation"
        ],
        "memory_pools": [
          "CodeHeap 'non-nmethods'",
          "Metaspace",
          "CodeHeap 'profiled nmethods'",
          "Compressed Class Space",
          "G1 Eden Space",
          "G1 Old Gen",
          "G1 Survivor Space",
          "CodeHeap 'non-profiled nmethods'"
        ],
        "using_compressed_ordinary_object_pointers": "true",
        "input_arguments": [
          "-XX:+UseG1GC",
          "-XX:G1ReservePercent=25",
          "-XX:InitiatingHeapOccupancyPercent=30",
          "-XX:+ExitOnOutOfMemoryError",
          "-Xss1m",
          "-Xms3036m",
          "-Xmx3036m",
          "-XX:+HeapDumpOnOutOfMemoryError",
          "--add-opens=java.base/java.io=ALL-UNNAMED",
          "-Dopensearch.path.conf=/etc/elasticsearch",
          "-Dopensearch.transport.cname_in_publish_address=true",
          "-Djava.awt.headless=true",
          "-Dfile.encoding=UTF-8",
          "-Djna.nosys=true",
          "-Djdk.io.permissionsUseCanonicalPath=true",
          "-Dio.netty.noUnsafe=true",
          "-Dio.netty.noKeySetOptimization=true",
          "-Dio.netty.recycler.maxCapacityPerThread=0",
          "-Dlog4j2.formatMsgNoLookups=true",
          "-Dlog4j.shutdownHookEnabled=false",
          "-Dlog4j2.disable.jmx=true",
          "-Dlog4j.skipJansi=true",
          "-Dopensearch.path.home=/opt/opensearch1",
          "-Dsecurity.default_init.dir=/etc/elasticsearch/opensearch-security",
          "-Des.search.ignore_awareness_attributes=false"
        ]
      },

Try to parse it, See NPE

java.lang.NullPointerException: null
	at org.opensearch.client.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:82)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:185)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:146)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:87)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:91)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:55)
	at org.opensearch.client.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:81)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:185)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:146)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:87)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:91)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:55)
	at org.opensearch.client.json.JsonpDeserializerBase$StringMapDeserializer.deserialize(JsonpDeserializerBase.java:369)
	at org.opensearch.client.json.JsonpDeserializerBase$StringMapDeserializer.deserialize(JsonpDeserializerBase.java:355)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:87)
	at org.opensearch.client.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:81)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:185)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:146)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:87)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:91)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:55)
	at org.opensearch.client.transport.rest_client.RestClientTransport.decodeResponse(RestClientTransport.java:360)
	at org.opensearch.client.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:326)
	at org.opensearch.client.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:148)
	at org.opensearch.client.opensearch.nodes.OpenSearchNodesClient.info(OpenSearchNodesClient.java:145)

What is the expected behavior?

Perhaps make this fiels optional

What is your host/environment?

OS : Fedora Linux 38
Java : OpenJDK 64-Bit Server VM : 17.0.9
Open Search 1.3.13, trying to migrate to 2.14

@Bzil Bzil added bug Something isn't working untriaged labels Jun 20, 2024
@dblock
Copy link
Member

dblock commented Jun 21, 2024

Looks like a bug. Want to write a test and fix it?

FYI, we have recently merged a beginning of a code generator that aims to resolve this entire class of problems (#366). There are a few things you can do to help:

  1. Ensure that the specification for these APIs in https://github.com/opensearch-project/opensearch-api-specification is correct, and add tests for them in that repo.
  2. Write tests in this repo for the scenarios that are broken like the ones you're reporting and manually fix any of these bugs.

The combination will ensure that as we switch to the generator we're not introducing regressions.

@Bzil
Copy link
Author

Bzil commented Jun 24, 2024

Hi @dblock
I'm not familiar with writing a openapi spec, when I try to run opensearch-api-specification tests all of them are in error. So it's quite weird.

@dblock
Copy link
Member

dblock commented Jun 24, 2024

@Bzil i am here to help! Feel free to open issues in that repo. Do read the dev guide, some things require a bit of a setup.

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

2 participants