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)
- Application Insights runtime attach agent metric-filtering not working HOT 10
- Is there a way to sample overrides Servicebus requests? HOT 18
- Workflow failed: OWASP dependency check (daily) (#532) HOT 1
- Workflow failed: OWASP dependency check (daily) (#542)
- Workflow failed: OWASP dependency check (daily) (#547)
- Sampling based on dependency result HOT 2
- OpenTelemetry support for MQTT pub/sub with Application Insights Java agent HOT 1
- Ignore newline and carriage return in the connection string file
- Sampling override based on request processing time? HOT 7
- Support for OTEL Synchronous Gauge HOT 3
- ignore InProc sampling dependencies
- Sampling override with http.response.status_code doesn't work HOT 6
- MySql dependency tree not available with applicationinsights-agent-3.5.1 HOT 5
- Question: How to turn off instrumentation of just Azure Service Bus
- Workflow failed: OWASP dependency check (daily) (#585)
- Custom Availability telemetry not working HOT 2
- Azure ServiceBus dependency tree not available with applicationinsights-agent-3.5.2 HOT 2
- Can't load log handler "com.microsoft.applicationinsights.TelemetryClient" - AI 3.5.2 in Java HOT 2
- SFTP dependency tree not available with applicationinsights-agent-3.5.2 HOT 5
- APPLICATIONINSIGHTS_CONNECTION_STRING does not work in 3.5.x, works in 3.4.x HOT 14
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.