Comments (5)
@lmcdasi The Linux user of the JVM may not have access to /proc/7/root/tmp
. Could you please check?
It does not work without -Djdk.attach.allowAttachSelf=true
?
from applicationinsights-java.
The jvm option: -Djdk.attach.allowAttachSelf=true seems to be mandatory. I'm using MSFT openjdk:17 docker image.
Without it, I'm getting:
connector | 14:39:06.600 [main] INFO connector.Application -- ApplicationInsights enabled with file /tmp/app-insights/applicationinsights-dev.json
connector | Jan 29, 2024 2:39:06 PM com.microsoft.applicationinsights.attach.ApplicationInsights attach
connector | WARNING: Fail to runtime attach Application Insights
connector | io.opentelemetry.contrib.attach.core.RuntimeAttachException: A problem has occurred during the runtime attachment of the Java agent.
connector | at io.opentelemetry.contrib.attach.core.CoreRuntimeAttach.handleByteBuddyException(CoreRuntimeAttach.java:106)
connector | at io.opentelemetry.contrib.attach.core.CoreRuntimeAttach.attachJavaagentToCurrentJVM(CoreRuntimeAttach.java:55)
connector | at com.microsoft.applicationinsights.attach.ApplicationInsights.attach(ApplicationInsights.java:63)
connector | at connector.Application.main(Application.java:38)
media-connector | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
connector | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
connector | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
connector | at java.base/java.lang.reflect.Method.invoke(Method.java:568)
connector | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
connector | at org.springframework.boot.loader.Launcher.launch(Launcher.java:95)
connector | at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
connector | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
connector | Caused by: java.lang.IllegalStateException: Could not self-attach to current VM using external process
connector | at net.bytebuddy.agent.ByteBuddyAgent.installExternal(ByteBuddyAgent.java:706)
connector | at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:636)
connector | at net.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:303)
connector | at net.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:268)
connector | at net.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:250)
connector | at io.opentelemetry.contrib.attach.core.CoreRuntimeAttach.attachJavaagentToCurrentJVM(CoreRuntimeAttach.java:53)
connector | ... 10 more
from applicationinsights-java.
Regarding /tmp - it seems that if I have it as a volume mounted in docker compose it affects the way it sees that java pid file. I have changed the strategy and now with the allowAttachSelf set to true there is no exception any longer.
connector | OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
connector | 2024-01-29 14:46:57.610Z INFO c.m.applicationinsights.agent - Application Insights Java Agent 3.4.19 started successfully (PID 7, JVM running for 4.855 s)
connector | 2024-01-29 14:46:57.615Z INFO c.m.applicationinsights.agent - Java version: 17.0.10, vendor: Microsoft, home: /usr/lib/jvm/msopenjdk-17-amd64
from applicationinsights-java.
Regarding /tmp - it seems that if I have it as a volume mounted in docker compose it affects the way it sees that java pid file. I have changed the strategy and now with the allowAttachSelf set to true there is no exception any longer.
Thank you for sharing this. Would you mind if you could share the code of the not working Docker compose configuration?
Does it also work now without the allowAttachSelf
property? If it does not work in this case, you can display the root cause error by setting the net.bytebuddy.agent.attacher.dump
property to a file path.
from applicationinsights-java.
Here is what is causing the issue of the self attach to fail. If in the docker-compose, I have:
JAVA_OPTIONS: "-DAPPLICATIONINSIGHTS_ENABLED=true -Dapplicationinsights.configuration.file=/mnt/app-insights/applicationinsights-dev.json -Dnet.bytebuddy.agent.attacher.dump=/tmp/bytebuddy.dump"
JAVA_TOOL_OPTIONS: "-agentlib:jdwp=transport=dt_socket,address=*:5006,server=y,suspend=n"
Then I will get the self attach issue. But, if I move the java_tool_options within the java options as:
JAVA_OPTIONS: "-agentlib:jdwp=transport=dt_socket,address=*:5006,server=y,suspend=n -XX:+StartAttachListener -XX:-DisableAttachMechanism -DAPPLICATIONINSIGHTS_ENABLED=true -Dapplicationinsights.configuration.file=/mnt/app-insights/applicationinsights-dev.json -Dnet.bytebuddy.agent.attacher.dump=/tmp/bytebuddy.dump"
Then I have no issue, and that because the agent is running the Agent.class as a new java process and inherits the debugger settings ... ByteBuddyAgent.class method installExternal - if (new ProcessBuilder(System.getProperty(JAVA_HOME) ....
Thank you.
from applicationinsights-java.
Related Issues (20)
- in the latest JAR 3.4.18, there are two HIGH Vulnerabilities CVE-2023-6378 with ch.qos.logback:logback-classic and ch.qos.logback:logback-core HOT 2
- Classic SDK TelemetryClient not capturing any data HOT 4
- Add ability to disable reactor instrumentation HOT 3
- Allow connectionString to be overridden multiple times without restarting the AppInsights Agent HOT 5
- 3.4.19 + Ktor OpenTelemetry - ClassCastException HOT 5
- Possibly incorrect mapping of Trace ID and Span ID HOT 8
- Unable to suppress dependencies using java agent HOT 12
- Java log4j2: Log messages go missing sporadically, especially in multi-threaded scenarios HOT 1
- how to turn off customMetrics, performanceCounters and metrics HOT 8
- TimeoutException when ingesting logs into AI HOT 13
- Help to ignore InProc sampling dependencies HOT 5
- Problem to configure sampling override HOT 6
- Auto-instrumentation support for Pekko 1.0.0 in Java agent HOT 2
- TRACE log level causes an application to fail HOT 10
- [Question] Why relocate logback packages and configuration files HOT 2
- How to add a Prefix to the names of the default captured metrics HOT 4
- Azure function app integration to Dynatrace in Linux with Open telemetry HOT 2
- HTTP dependencies are not reported in latest Spring Boot 3.2. HOT 2
- Download URL format changed in 3.5.0 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from applicationinsights-java.