-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Elasticsearch - FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed #850
Comments
After some testing, I believe this is an issue with Elasticsearch/Docker image.
|
I have add env in shell. and ES can startup, but there are no port 12345 listening. [elk@elk1 ~]$ netstat -nltp |
You have a typo in your variable name |
more testing, should be set env name with ES_JAVA_OPTS, but not ES_JAVA_OPTIS, but I got same errors. and I just use tarball version ES, not docker image. I have also test ES 8.6, same errors. apprecaite you give more clue and more help. [elk@elk1 ~]$ export ES_JAVA_OPTS="$ES_JAVA_OPTS -javaagent:/elk/jmx_prometheus_javaagent-0.19.0.jar=12345:/elk/config.yaml" [elk@elk1 ~]$ /elk/ELK/elasticsearch-8.3.2/bin/elasticsearch -d |
interesting test result. CLI_JAVA_OPTS works, but I can temporarily see jvm metrics on port 12345 during the ES starting stage. export CLI_JAVA_OPTS="$CLI_JAVA_OPTS -javaagent:/elk/jmx_prometheus_javaagent-0.19.0.jar=12345:/elk/config.yaml" you can see 12345 is listening below: [root@elk1 ~]# netstat -nltp but 12345 port disappear after port 9200 listening. and I could not access metrics. any clues, Thank you in advance. |
and I try ES 7.17.11, 12345 port can startup, but I could not access the metrics, no firewall open. [elk@elk1 ~]$ export ES_JAVA_OPTS="$ES_JAVA_OPTS -javaagent:/elk/jmx_prometheus_javaagent-0.19.0.jar=12345:/elk/config.yaml" [elk@elk1 ~]$ netstat -nltp [root@elk1 ~]# curl http://elk1:9200 |
Can create/publish a Docker image or provide a Dockerfile that can be used for testing/reproducing the issue? |
I do not have docker evnironment. just download the ES from and jmx_exporter from https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.19.0/jmx_prometheus_javaagent-0.19.0.jar unzip the ES in somewhere and run below command, you may see the errors same with me (ES_JAVA_OPTS). export CLI_JAVA_OPTS="$CLI_JAVA_OPTS -javaagent:/elk/jmx_prometheus_javaagent-0.19.0.jar=12345:/elk/config.yaml" appreciate further help. |
I just set up a new CentOS Stream 9 VM and followed your instructions - works as expected/no issues. |
ok, my OS is redhat 8.4, but I do not think the issue related to OS level. May I have your config.yaml content. netstat -nltp |
(truncated output) |
May I know how do you startup the es, Thanks. |
|
found reason why 12345 port disapper. I run elasticsearch with -d to put es in background, so the agent process gone. so I run below to solve the issue: Thank you so much. really appreciate. |
The exporter agent is loaded as part of the running JVM - it will stay running as long as the process loading it is running. I would create an issue/consult the Elasticsearch project for guidance on how to use a Java agent when running Elasticsearch in daemon mode. |
found another problem, the jmx exporter do not get jvm metrics from ES, ES GC is G1, but I could not found any G1 pool metrics. any idea, thanks. [elk@alma elasticsearch-8.8.2]$ ps -ef |grep elastic |grep -i g1 metric on port 12345 HELP jvm_memory_pool_bytes_max Max bytes of a given JVM memory pool.TYPE jvm_memory_pool_bytes_max gaugejvm_memory_pool_bytes_max{pool="CodeHeap 'non-nmethods'",} 5828608.0 |
Looking at the command, I don't see the Java agent exporter configured but I do see external JMX configuration values. Are you using |
I am not using jmx_prometheus_httpserver.jar, external JMX configuration just for learnning MBean. [elk@alma elasticsearch-8.8.2]$ cat start.sh #!/bin/bash found ES running process as sub process under jmx-exporter one. [elk@alma ~]$ netstat -nltp And may I have any update in the issue/consult how to use java agent when running in daemon mode. |
Interesting... can you confirm the Java version you are using? (I belive that Elasticsearch bundles a JVM.) |
Using the JVM bundled with 8.8.2 and using an exporter.yaml with...
The results are...
|
yes, using bundles JVM, and I have try same config.yaml. but still could not get G1 metrics. any other differency on my side. |
Debugging...
Did you create an issue/consult the Elasticsearch project for guidance on how to use a Java agent when running Elasticsearch? |
This is definitely module related. If I set
The exporter loads and listens on the specified port, accepts the request, then closes the connection without any output. |
@real747-david @Stono I have determined configuration changes in Elasticsearch to allow the
where the path to the jar and exporter.yaml is absolute.
Edit the Elasticsearch JVM java.policy settings (
|
config.yaml
rules:
ES using bundled JDK
openjdk version "18.0.1.1" 2022-04-22
OpenJDK Runtime Environment (build 18.0.1.1+2-6)
OpenJDK 64-Bit Server VM (build 18.0.1.1+2-6, mixed mode, sharing)
add "-javaagent:/elk/jmx_prometheus_javaagent-0.19.0.jar=12345:/elk/config.yaml" in elasticsearch 8.3.2 jvm.options , start ES and got error:
Exception in thread "main" java.lang.reflect.InvocationTargetException
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:491)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:503)
Caused by: java.lang.NoClassDefFoundError: com/sun/net/httpserver/Authenticator
at io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:39)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
... 3 more
Caused by: java.lang.ClassNotFoundException: com.sun.net.httpserver.Authenticator
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
*** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at open/src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
The text was updated successfully, but these errors were encountered: