coursera / metrics-datadog

metrics-datadog
Other
187 stars 105 forks source link

JVM File Descriptor gauge reporting issue in Java 10 #100

Open envybee opened 6 years ago

envybee commented 6 years ago

We started seeing these issues once we moved to Java 10:

ERROR o.c.metrics.datadog.DatadogReporter - Error reporting gauge metric (name: jvm.fd, tags: []) to Datadog, continuing reporting other metrics.\njava.lang.reflect.InaccessibleObjectException: Unable to make public long com.sun.management.internal.OperatingSystemImpl.getOpenFileDescriptorCount() accessible: module jdk.management does not \"opens com.sun.management.internal\" to unnamed module @49ff7d8c\n\tat java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337)\n\tat java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281)\n\tat java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198)\n\tat java.base/java.lang.reflect.Method.setAccessible(Method.java:192)\n\tat com.codahale.metrics.jvm.FileDescriptorRatioGauge.invoke(FileDescriptorRatioGauge.java:48)\n\tat com.codahale.metrics.jvm.FileDescriptorRatioGauge.getRatio(FileDescriptorRatioGauge.java:35)\n\tat com.codahale.metrics.RatioGauge.getValue(RatioGauge.java:64)\n\tat com.codahale.metrics.RatioGauge.getValue(RatioGauge.java:11)\n\tat org.coursera.metrics.datadog.DatadogReporter.reportGauge(DatadogReporter.java:210)\n\tat org.coursera.metrics.datadog.DatadogReporter.report(DatadogReporter.java:90)\n\tat com.codahale.metrics.ScheduledReporter.report(ScheduledReporter.java:162)\n\tat com.codahale.metrics.ScheduledReporter$1.run(ScheduledReporter.java:117)\n\tat java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)\n\tat java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)\n\tat java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)\n\tat java.base/java.lang.Thread.run(Thread.java:844)

Is there a way this can be fixed?

samzx commented 4 years ago

@envybee did you find a solution to this?

envybee commented 4 years ago

@samzx Unfortunately no, we still have this issue

billonahill commented 3 years ago

Also ran into this. Was able to work around it by adding --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED to the java start command.

See https://stackoverflow.com/questions/55952859/unable-to-make-public-long-com-sun-management-internal-operatingsystemimpl-getop