Yourkit Remote Profiling - Not Attaching

Questions about YourKit Java Profiler
lalit.r.nagpal
Posts: 13
Joined: Wed Jul 09, 2014 2:07 pm

Re: Yourkit Remote Profiling - Not Attaching

Post by lalit.r.nagpal »

Thanks Anton, we will keep trying at our end parallely. The other problem that we are worried about in parallel to this is

[<user>@<server> bin]$ yjp.sh -attach
Picked up JAVA_TOOL_OPTIONS:
[YourKit Java Profiler 2014 EAP build 14074] Log file: /home/wasadm/.yjp/log/yjp-16782.log
No running JVMs to attach found.
Enter PID of the application you want to attach (0 to exit) and press Enter:
>0
Exited

There are no JVMs being reported for attaching. We are publishing via listen=<eth0 ip address>:<10001> port and it is listening there
[<user>@<server> bin]$ netstat -natu | grep 10001
tcp 0 0 <eth0 IP address>:10001 0.0.0.0:* LISTEN

[<user>@<server> bin]$ telnet <eth0 ip address> 10001
Trying <eth0 ip address>...
Connected to <eth0 ip address>.
Escape character is '^]'.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Yourkit Remote Profiling - Not Attaching

Post by Anton Katilin »

You should not rely on nor worry about "yjp.sh -attach" if you start application the with profiler agent. The attach mechanism detects applications a) visible with the JVM's attach API which does not always work (Java version mismatch, user mismatch) and b) already running JVM instances with agent loaded by inspecting special markers in a shared memory region which can also fail due to shared memory access issues.

The profiler communicates with the agent through the port, and nothing else matters.

So you should instead check with
java -jar yjp-controller-api-redist.jar localhost 10001 print-current-status
...as you did in the past.
lalit.r.nagpal
Posts: 13
Joined: Wed Jul 09, 2014 2:07 pm

Re: Yourkit Remote Profiling - Not Attaching

Post by lalit.r.nagpal »

Ok, so this worked finally with the manual tunneling approach. Going to post it here so that it also helps others who fall into the same situation we did. We have to hop through a intermediate linux server to reach the servers that have our application server WebSphere hosting our java applications.

Windows Client >--ssh--> Intermediate Linux Server >--ssh--> Target Server to Profile on Linux

Yourkit establishes a ssh connection from the windows client to intermediate linux server and then tries to do a tcp connection from intermediate server to target server ( tries to scan all ports from 10001 - 10010 ). So, something like this.

Windows Client >--ssh--> Intermediate Linux Server >--TCP--> Target Server to Profile on Linux

In our case the ssh connection was working out well but the tcp connection from the intermediate server to the target server was not working - it also needed a ssh protocol, which wasn't happening here.

The following command was used to create a manual ssh tunnel between the intermediate server to target server ( note: i am publising using the listen=<target server ip>:10001 port - so port is fixed )

ssh -L 10001:<target server>:10001 <user>@<target server> -p 22

and then Yourkit windows client was used to ssh remote profile at
<user>@<intermediate server> localhost:10001

It worked !!! Thanks to Jatin Desai and Anton Katilin both of you for your directions in getting this done.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Yourkit Remote Profiling - Not Attaching

Post by Anton Katilin »

Great news :)

Thank you for the detailed explanation of what you did to make it finally work.
This information may be used for others too.
Post Reply