Remote Profiling: "No applications found"

Questions about YourKit Java Profiler
Post Reply
jayerb
Posts: 6
Joined: Tue Nov 23, 2021 1:48 am

Remote Profiling: "No applications found"

Post by jayerb »

After starting my tomcat server in a docker container with a CATALINA_OPTS value of:
-agentpath:/usr/local/tomcat/yjp/linux-x86-64/libyjpagent.so=port=10002,listen=all

The attempt to create a remote, simple connection via the yourkit UI fails with "No applications found".

The yourkit agent is running on the specified port, but I get "no response from server" when attempting to connect to http://127.0.0.1:10002

A connection with netcat to 127.0.0.1 10002 is successful, but not very useful.

Here is a fragment from my yjp log file:

21.11-213 0.001: Executable: /usr/local/openjdk-8/bin/java
21.11-213 0.001: uname:
sysname: Linux
release: 5.10.47-linuxkit
version: #1 SMP Sat Jul 3 21:51:47 UTC 2021
machine: x86_64
21.11-213 0.001: Linux; linux-x86-64; 64-bit process
21.11-213 0.001: hid: 3602619757ZX84999504958U93Z9114V1V 64-bit machine
21.11-213 0.001: RAM: 7959 MB
21.11-213 0.001: Today is 20211123
21.11-213 0.001: full_build_stamp: 2021.11.213 202111190313
21.11-213 0.001: Agent library path: /usr/local/tomcat/yjp/linux-x86-64/libyjpagent.so
21.11-213 0.001: getTimeNsInfo: "monotonic"
21.11-213 0.001: Agent_OnLoad: orig_options=port=10002,listen=all
full_options=port=10002,listen=all
21.11-213 0.001: jvmtiVersion: 30010203
21.11-213 0.001: phase: 1
21.11-213 0.001: vendor: Oracle Corporation
21.11-213 0.001: version: 25.292-b10
21.11-213 0.001: specVersion: 1.8
21.11-213 0.001: info: mixed mode, sharing
21.11-213 0.001: heap_sampling: capability is not available
21.11-213 0.001: asynchronous sampling: available
21.11-213 0.001: inside Kubernetes: 0
21.11-213 0.002: session GUID: 5932598911
21.11-213 0.003: line_method: 1
21.11-213 0.003: can_generate_early_class_hook_events: optional capability is not available
21.11-213 0.003: can_suspend: optional capability is not available
21.11-213 0.009: Jar file created: /tmp/yjp202111190313.jar
21.11-213 0.009: JVMTI 30010203; 25.292-b10; Oracle Corporation; mixed mode, sharing; Java version: 8
21.11-213 0.044: Successfully registered probes: 29
Registered: .AgentLoadingSupport
Registered: .AsyncChannels
Registered: .AsyncSamplingSupport
Registered: .AwtEvents
Registered: .Cassandra
Registered: .CassandraLW
Registered: .Databases
Registered: .DatabasesLW
Registered: .DirectoryStreams
Registered: .Files
Registered: .FilesLW
Registered: .HBase
Registered: .HBaseLW
Registered: .JNDI
Registered: .JPA_DataNucleus
Registered: .JPA_EclipseLink
Registered: .JPA_Hibernate
Registered: .JPA_OpenJPA
Registered: .JUnitTests
Registered: .MongoDB
Registered: .MongoDBLW
Registered: .Processes
Registered: .Servlets
Registered: .ServletsLW
Registered: .Sockets
Registered: .SocketsLW
Registered: .Sync
Registered: .TestNg
Registered: .Threads
21.11-213 0.098: agentStart: 1
21.11-213 0.098: agentStart: 2
21.11-213 0.098: agentStart: OK
21.11-213 0.117: tracing=off: large method: 3945 sun.nio.cs.StandardCharsets$Aliases init(java.lang.Object[])
21.11-213 0.190: vmInit: 1
21.11-213 0.191: vmInit: load all method IDs
21.11-213 0.193: vmInit: 2
21.11-213 0.193: agentInit: 1
21.11-213 0.195: agentInit: Core loaded
21.11-213 0.241: tracing=off: large method: 2252 jdk.internal.org.objectweb.asm.Frame execute(int, int, jdk.internal.org.objectweb.asm.ClassWriter, jdk.internal.org.objectweb.asm.Item)
21.11-213 0.360: setTriggers:

21.11-213 0.360: setTriggers: to unregister: 0
21.11-213 0.360: setTriggers: method listeners to register: 0
21.11-213 0.360: setTriggers: OK
21.11-213 0.360: ourUnsafe: true
21.11-213 0.371: agentInit: Core.init() called
21.11-213 0.371: [ssl-config] generating SSL certificate...
21.11-213 0.371: [ssl-config] OpenSSL 1.1.1l 24 Aug 2021
21.11-213 0.371: agentInit: OK
21.11-213 0.371: vmInit: 3
21.11-213 0.371: onStartProfiling: entering...
21.11-213 0.371: onStartProfiling: done
21.11-213 0.371: vmInit: OK
21.11-213 0.402: [ssl-config] generating SSL certificate done: ctx 2, big 0, key 28, serial 0, cert 0, sign 1, use 0
21.11-213 0.402: [server] listening; port=10002; ip=0.0.0.0; url=https://127.0.0.1:10002
21.11-213 0.405: [shmem] get size result=1, size=0
21.11-213 0.405: [shmem] mapped address=00007F5534047000, mapped size=106500, area size=106500
21.11-213 0.412: *** HINT ***: To get profiling results, connect to the application from the profiler UI
21.11-213 0.428: SP: pin java.lang.ClassNotFoundException
21.11-213 0.513: SP: pin java.io.FileNotFoundException
21.11-213 0.514: SP: pin java.security.PrivilegedActionException
21.11-213 0.571: tracing=off: large method: 4120 sun.text.resources.FormatData getContents()
21.11-213 0.580: tracing=off: large method: 8742 sun.util.resources.CurrencyNames getContents()
21.11-213 0.622: SP: pin java.net.MalformedURLException
21.11-213 0.635: [m: 7353 73] total classes: processed=1000 instrumented=911 209ms
21.11-213 0.892: tracing=off: large method: 2346 com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver next()
21.11-213 1.042: GcPauseCounter: installed to PS Scavenge
21.11-213 1.042: GcPauseCounter: installed to PS MarkSweep
21.11-213 1.048: GC bean name: [1] PS Scavenge
21.11-213 1.048: GC bean name: [2] PS MarkSweep
21.11-213 1.049: processorCount=8
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Remote Profiling: "No applications found"

Post by Anton Katilin »

Please see detailed instructions at
https://www.yourkit.com/docs/java/help/docker.jsp

Please don't forget to:
- expose the port ("EXPOSE 10002")
- run docker with "-p": "-p 10002:10002"

From the profiler UI you should make a remote connection to "localhost".
jayerb
Posts: 6
Joined: Tue Nov 23, 2021 1:48 am

Re: Remote Profiling: "No applications found"

Post by jayerb »

Thanks for responding.
Yes, I've done that. Since I launched it on port 10002 and exposed port 10002, I am able to connect to port 10002 on my host machine with both curl and netcat, but I get an empty response - not even a status code:

curl -v localhost:10002
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 10002 (#0)
> GET / HTTP/1.1
> Host: localhost:10002
> User-Agent: curl/7.64.1
> Accept: */*
>
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server
* Closing connection 0
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Remote Profiling: "No applications found"

Post by Anton Katilin »

jayerb
Posts: 6
Joined: Tue Nov 23, 2021 1:48 am

Re: Remote Profiling: "No applications found"

Post by jayerb »

{
"allocationRecording" : false,
"asyncSamplingCpu" : false,
"callCounting" : false,
"cpuProfiling" : false,
"deadlockDetected" : false,
"exceptionProfiling" : true,
"monitorProfiling" : false,
"pid" : 1,
"sampling" : false,
"sessionName" : "Tomcat",
"stackTelemetry" : true,
"tracing" : false
}
jayerb
Posts: 6
Joined: Tue Nov 23, 2021 1:48 am

Re: Remote Profiling: "No applications found"

Post by jayerb »

When I make the curl request I see this entry in the yjp log file in the container:

[http] 172.21.0.1 POST "/yjp/api/v1/getStatus" 200 463

However, when I attempt to connect from the client app, I see no messages in the log file.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Remote Profiling: "No applications found"

Post by Anton Katilin »

The status output means that the agent is reachable.

Does the UI connect to it or you still have a problem?

Please ensure you use the profiler UI of the same version as the agent.
However, when I attempt to connect from the client app, I see no messages in the log file.
It's normal. There should be no entry in the agent log if you connect from the UI.
jayerb
Posts: 6
Joined: Tue Nov 23, 2021 1:48 am

Re: Remote Profiling: "No applications found"

Post by jayerb »

The version mismatch was the problem! I downloaded the 2021.3 agent version to match my yourkit app version and now they are talking. Thanks Anton.
More of a hint of the mismatch would be nice - in the docs or in an error code from the UI.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Remote Profiling: "No applications found"

Post by Anton Katilin »

In version 2021.11 we have completely re-implemented the transport layer of communication between the profiler UI and the agent, to enable secure connection and some other benefits.

To provide explicit error about the version mismatch, the new version should be able to detect the old format data stream. It's not a trivial task for some technical reasons. It would require a significant complication of the involved code.
Post Reply