cannot run profiler with Montavista linux

Questions about YourKit Java Profiler
Post Reply
balajir
Posts: 9
Joined: Thu Jan 27, 2005 9:55 pm

cannot run profiler with Montavista linux

Post by balajir »

I followed the instructions for running the java application with profiler, by setting the LD_LIBRARY_PATH and adding the option -Xrunyjpagent. I was able to run the application successfully in solaris. But in linux, I tried the same. I am able to run the application for a small application for example.. java -Xrunyjpgagent Foo. But when I tried to run a application which is launched by a shell script , the application never launches. I am using MontaVista Linux. First I was under the assumption that the dependent libraries are not of correct version. But since I am able to launch a small application, I doubt is there anything wrong with my script. I have made sure that are no unresolved dependencies for the library.

> root@emsdev3:/usr/lib# ldd
> /export/home/tpadmin/yourkit/yjp-3.2/bin/linux/libyjpagent.so
> libltdl.so.3 => /usr/lib/libltdl.so.3 (0x40049000)
> libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40051000)
> libc.so.6 => /lib/libc.so.6 (0x400ff000)
> libdl.so.2 => /lib/libdl.so.2 (0x4022a000)
> libm.so.6 => /lib/libm.so.6 (0x4022d000)
> /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
>

Here is the script I am using. Any suggestions are greatly appreciated.

#!/bin/sh

cd ..
. ./setEnv.sh

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/app/AdventNet/WebNMS/apache/lib:/app/AdventNet/WebNMS/lib:/usr/j2se/jre/lib/sparc:/home/brajagopalan/yjp-3.2/bin/linux:/usr/lib:/lib

SSH_HOME=/app/AdventNet/WebNMS/sshtools
SSHLIB=$SSH_HOME/lib/jaxb-rt-1.0-ea.jar:$SSH_HOME/lib/sshtools-j2ssh-0.0.4-alpha.jar:$SSH_HOME/lib/log4j-1.2.6.jar

CLASS_PATH=$AN_CLASSES:$AN_TEST:$AN_JDBC:$SUM_CLIENT_CLASSPATH:$SUM_SERVER_CLASSPATH:$CUSTOMPATH:$SNMP_CLASSPATH:$SAS_CLASSPATH:$XML_CLASSPATH:$OTHER_CLASSPATH:$MS_CLASSPATH:$WEBSERVER_CLASSPATH:$DB_CLASSPATH:$JAVA_CLASSPATH:$BUILDER_CLASSPATH:$TFTP_CLASSPATH:$CLI_CLASSPATH:$TRANSACTION_CLASSPATH:$NMS_CLASSES/AdventNetSnmpDistributedAPI.jar:$JIMI_CLASSPATH:$MOPATH:$LICENSE_PATH:$FTP_CLASSPATH:$TP_CLASSPATH:$SSHLIB

# Uncomment the following lines for using TL1 Protocol.
CLASS_PATH=$CLASS_PATH:$TL1_CLASSPATH

# Uncomment the following lines for using JMX Agent.
CLASS_PATH=$CLASS_PATH:$JMX_AGENT_CLASSPATH

STACK_SIZE=-mx512m
REMOTE_DEBUG="-Xdebug -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"

Dargs=" -Drmi.debug=true
-Dsun.rmi.log.debug=true
-Dsun.rmi.transport.logLevel=VERBOSE
-Dsun.rmi.transport.tcp.logLevel=VERBOSE
-Dsun.rmi.server.logLevel=VERBOSE
-Dsun.rmi.loader.logLevel=VERBOSE
"
echo before the start $LD_LIBRARY_PATH
# -Xrunyjpagent:port=10002 \

$JAVA_HOME/bin/java \
$STACK_SIZE \
-Xrunyjpagent \
$REMOTE_DEBUG \
-cp $CLASS_PATH \
-Dsshtools.home=$SSH_HOME \
-Dcatalina.home=$TOMCAT_HOME \
-Dmysql.home=$MYSQL_HOME \
-Dwebserver.port=$WEBSERVER_PORT \
-Dresource_check="$WEBSERVER_PORT,$WEBCONTAINER_PORT" \
-Dwebserver.rootdir=$WEBSERVER_HOME \
-Djava.rmi.server.codebase="$CODEBASE_LIST" \
$Dargs \
com.trueposition.ems.server.app.main.NmsMainBE \
rediscoverNetwork NMS_BE_PORT 2000 ROOT_DIR /app/AdventNet/WebNMS \
SERVICE true

if[ $? -ne 0]
echo program failed to launch successfully
exit
else
echo program is running
exit

regards,
balaji
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

What does "the application never launches" means? Does it hang, or crashes? Are there any other messages printed in the console when you launch your script?

What Java do you use? Could you please insert lines 'echo $JAVA_HOME' and well as '$JAVA_HOME/bin/java -version' before line '$JAVA_HOME/bin/java \ ' of the script, and provide us with the output.
balajir
Posts: 9
Joined: Thu Jan 27, 2005 9:55 pm

Post by balajir »

Sorry I was not clear in my previous post. When I mentioned the application does launch, I mean to say there was no error message, and the app fails to run ( how do I determine it fails to run) , there is script which checks for the status of the application. Also I am trying to run a server app, the client cannot establish any connection to the server.


JAVA_HOME is /usr/java/j2sdk1.4.2_06/jre

/usr/java/j2sdk1.4.2_06/jre/bin/java -version
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Post by Vladimir Kondratyev »

Most probable problem is in your startup script. Unfortunately it's too long to instantly say where the error is.

Please try launch $YJP_HOME/samples/sample2/run.sh. It's _very_ simple application which can help us to find a problem.
balajir
Posts: 9
Joined: Thu Jan 27, 2005 9:55 pm

Post by balajir »

As I mentioned, I have no problems in running simple applications. I am able to run your sample program successfully.

root@emsdev3:/export/home/tpadmin/yourkit/yjp-3.2/samples/sample2# ./run.sh [YourKit Java Profiler 3.2 #451] Listening on port 10000...
[YourKit Java Profiler 3.2 #451] Request from 127.0.0.1: Memory snapshot is saved to /root/SelfProfilingDemo.memory

When I try to run this application from the script.. there are no log files created , which means the application does'nt get to the stage of basic initialization.

I sort of feel the same, there is something wrong with my startupscript. But the same script works for solaris, and I am able to do capture memory snapshots, and there are no issues.
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Post by Vladimir Kondratyev »

Does your script work without profiler specific changes? If it works and sample program also works, then the problem is only in LD_LIBRARY_PATH configuration..
balajir
Posts: 9
Joined: Thu Jan 27, 2005 9:55 pm

Post by balajir »

When I remove -Xrunyjpagent the application starts successfully. Before the start of the application I echo the LD_LIBRARY_PATH, which does have the yjp_path set properly.

before the start /home/brajagopalan/yjp-3.2/bin/linux:/usr/lib:/lib:/app/AdventNet/WebNMS/lib:/app/AdventNet/WebNMS/apache/lib:/app/AdventNet/WebNMS/apache/lib:/app/AdventNet/WebNMS/lib:/usr/j2se/jre/lib/sparc:/home/brajagopalan/yjp-3.2/bin/linux:/usr/lib:/lib
Customized NmsMainBE Started ...
RMI SocketFactory Started ...
Created trigger AlarmCorrelateOnUpdate
RMI server port: 12345
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Post by Vladimir Kondratyev »

Do you have any error message in console?
balajir
Posts: 9
Joined: Thu Jan 27, 2005 9:55 pm

Post by balajir »

There are no error messages. The application just hangs, it does'nt dump core nor there are any exceptions.

root@emsdev3:/app/ems/current/bin# ./starttpems
before the start /home/brajagopalan/yjp-3.2/bin/linux:/usr/lib:/lib:/app/AdventNet/WebNMS/lib:/app/AdventNet/WebNMS/apache/lib:/app/AdventNet/WebNMS/apache/lib:/app/AdventNet/WebNMS/lib:/usr/j2se/jre/lib/sparc:/home/brajagopalan/yjp-3.2/bin/linux:/usr/lib:/lib<-------------------------- stops right here.

which is $JAVA_HOME/bin/java \
-Xrunyjpagent:port=20000 \
$STACK_SIZE \
$REMOTE_DEBUG \
-cp $CLASS_PATH \
-Dsshtools.home=$SSH_HOME \
-Dcatalina.home=$TOMCAT_HOME \
-Dmysql.home=$MYSQL_HOME \
-Dwebserver.port=$WEBSERVER_PORT \
-Dresource_check="$WEBSERVER_PORT,$WEBCONTAINER_PORT" \
-Dwebserver.rootdir=$WEBSERVER_HOME \
-Djava.rmi.server.codebase="$CODEBASE_LIST" \
$Dargs \
com.trueposition.ems.server.app.main.NmsMainBE \
rediscoverNetwork NMS_BE_PORT 2000 ROOT_DIR /app/AdventNet/WebNMS \
SERVICE true
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Post by Vladimir Kondratyev »

Please try to remove parameters for remove debugging:

REMOTE_DEBUG="-Xdebug -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"
balajir
Posts: 9
Joined: Thu Jan 27, 2005 9:55 pm

Post by balajir »

When I removed REMOTE_DEBUG the application started to run and I was able to capture snapshots. But now the remote debugging is not on. So I cannot connect to the sever remotely from IntelliJ for debugging purpose. I am able to use the REMOTE_DEBUG option in solaris. Is this something to do with MontaVista ??
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Post by Vladimir Kondratyev »

OK. We'll try fo find workaround for the problem. I'm sure that bug will not be fixed in version 3.2, so the fix will go into 4.0 branch (http://www.yourkit.com/eap)
balajir
Posts: 9
Joined: Thu Jan 27, 2005 9:55 pm

Post by balajir »

Can you please mail me, once you have the work around. Also I tried to run 4.0, the same problem exists. Please let me know when is the latest build this problem will be addressed.
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Post by Vladimir Kondratyev »

Unfortunately we cannot reproduce hangup here. We do not have Monta Vista Linux so we've tried RedHat Linux 7.3 and FC2.

What is the version of your MontaVista Linux? What is the output of "uname -a" command?
balajir
Posts: 9
Joined: Thu Jan 27, 2005 9:55 pm

Post by balajir »

tpadmin@emsdev3:/$ uname -a
Linux emsdev3 2.4.18_mvlcge30-se750Xwv2 #1 SMP Tue Jul 15 17:52:35 PDT 2003 i686 unknown
Post Reply