Skip to content

Nodes stats returns -1 cpu percent on my desktop #72887

@nik9000

Description

@nik9000

Elasticsearch version (bin/elasticsearch --version): master

Plugins installed: none

JVM version (java -version):

=======================================
Elasticsearch Build Hamster says Hello!
  Gradle Version        : 7.0
  OS Info               : Linux 5.11.15-arch1-2 (amd64)
  JDK Version           : 15 (AdoptOpenJDK)
  JAVA_HOME             : /usr/lib/jvm/java-15-adoptopenjdk
  Random Testing Seed   : AF807D8F67D509D1
  In FIPS 140 mode      : false
=======================================

OS version (uname -a if on a Unix-like system):

Linux beast 5.11.15-arch1-2 #1 SMP PREEMPT Sat, 17 Apr 2021 00:22:30 +0000 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:
GET /_nodes/stats and GET /_cat/nodes returns -1 for my cpu load percent. It looks like OperatingSystemMXBean.getSystemCpuLoad is returning -1 for me. Its documented as doing that if the load isn't available.

Steps to reproduce:

  1. Get my desktop
  2. ./gradlew -p docs check -Dtests.method='*cat*'
  3. That fails to match the pattern, getting a -1 on load.
  4. You could also ./gradlew run and GET /_nodes/stats. That dumps:
        "cpu" : {
          "percent" : -1,
          "load_average" : {
            "1m" : 0.44,
            "5m" : 0.37,
            "15m" : 0.43
          }
        },

It looks like this is super rare on developer machines because we don't expect -1 in the tests. Do we to modify the tests? Do we want to figure out why the jvm can't get my load percentage?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions