2017-09-11 1 views
-1

Veuillez aider comment aborderiez-vous le débogage d'une application JNI.Application JNI suspendue

occasion JPS pour obtenir pid du processus qui est en cours d'exécution jvm:

$ jps 
8248    <- this is the pid of the process that was span up by a C++ application to run JNI stuff ... 
8335 Jps 

Maintenant, nous pouvons attacher gdb à cette pile.

$ gdb -p 8248 
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-94.el7 
.... /cut/ 
(gdb) 
(gdb) bt 
#0 0x00007fddd9f141bd in __lll_lock_wait() from /lib64/libpthread.so.0 
#1 0x00007fddd9f0fd02 in _L_lock_791() from /lib64/libpthread.so.0 
#2 0x00007fddd9f0fc08 in pthread_mutex_lock() from /lib64/libpthread.so.0 
#3 0x00007fddda9f3e26 in mutexLock() from /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 
#4 0x00007fddda9ed6f1 in setTLSExceptionStrings() from /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 
#5 0x00007fddda9ec38c in printExceptionAndFreeV() from /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 
#6 0x00007fddda9ec52d in printExceptionAndFree() from /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 
#7 0x00007fddda9ed46b in getJNIEnv() from /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 
#8 0x00007fddda9eee94 in hdfsBuilderConnect() from /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 
#9 0x0000000000400950 in main() 

Notez qu'il est suspendu dans une sorte de mutex verrouillage global

Je pense que ce gdb pile Backtrace devrait être très utile pour identifier la cause de ce problème.

Cela devrait être une question générique de débogage JNI? Si si vous êtes intéressé est ici code C qui couvre une machine virtuelle Java pour l'interaction JNI - https://gist.github.com/Tagar/7c42f82f5538004bda2f4ea0b0e0adc5

java version "1.8.0_141" gcc version 4.8.5 20.150.623 (Red Hat 4.8.5-11) (GCC)

environnement Durée:

export LD_LIBRARY_PATH=$CDH/lib64:$JAVA_HOME/jre/lib/$OS_ARCH/server 
export CLASSPATH=`hadoop classpath` 
export _JAVA_OPTIONS=-Xss1280m 

Merci pour toutes les pistes.

également, en fonction de la pendaison empilez essayait d'échouer

#6 0x00007fddda9ec52d in printExceptionAndFree() from /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 
#7 0x00007fddda9ed46b in getJNIEnv() from /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 

mais est en attente de tentative de printExceptionAndFreeV() -> setTLSExceptionStrings() -> mutexLock() serrure ..

+1

@MahonriMoriancumer Modification rejetée. Le code JNI est écrit en C ou C++. OP n'a pas specifeid qui, et il n'est pas clair de la trace de la pile. – EJP

Répondre