Linux上的Java System.loadLibrary调用冻结
我有一个非常小的.so文件(可在此处找到:https
://docs.google.com/leaf?id=0B4MxFm-
ACB3INjhkMjhlNzktYzkxYy00Zjk5LTk0Y2MtZDE2MWQ2MzY1OWUy
&hl=zh_CN&
authkey =CMrJguwN)
我试图将其加载到RHEL上的Java中,而Java
main
只是冻结(没有错误或异常)。我在LD_LIBRARY_PATH上有带有.so文件的目录,因此我知道它实际上是在尝试加载它。
有什么想法可以解决这个问题吗?
public class SmallTester { public static void main(String[] args){
for(String s: System.getenv("LD_LIBRARY_PATH").split(":")){
System.out.println(s);
}
System.loadLibrary("TestAda");
System.out.println("Here");
}
}
编辑:
根据下面的帖子,我做了一个跟踪。看起来像一遍又一遍地重复此调用(我不确定这是什么意思?):
[pid 31464] clock_gettime(CLOCK_MONOTONIC, {3605675, 624255544}) = 0[pid 31464] gettimeofday({1306417113, 168967}, NULL) = 0
[pid 31464] clock_gettime(CLOCK_MONOTONIC, {3605675, 624435576}) = 0
[pid 31464] clock_gettime(CLOCK_MONOTONIC, {3605675, 624518205}) = 0
[pid 31464] gettimeofday({1306417113, 169216}, NULL) = 0
[pid 31464] clock_gettime(CLOCK_REALTIME, {1306417113, 169306590}) = 0
[pid 31464] futex(0x88b3f04, FUTEX_WAIT_PRIVATE, 1, {0, 49909410}) = -1 ETIMEDOUT (Connection timed out)
这是日志的完整版本:https : //docs.google.com/leaf?id=0B4MxFm-
ACB3IYzdhZWIwNWEtYjUzMS00NGM5LWEzZjQtYzMzOWE3MWNhYWQ0&hl=en_US&authkey=CJ-
Lv_wGG
EDIT2:我也尝试使用JNA加载库:
public class SmallTesterJNA { public interface CLibrary extends Library {
CLibrary INSTANCE1 = (CLibrary)
Native.loadLibrary("TestAda", // <<< our library goes here
CLibrary.class);
}
public static void main(String[] args){
for(String s: System.getenv("LD_LIBRARY_PATH").split(":")){
System.out.println(s);
}
System.loadLibrary(CLibrary.INSTANCE1.toString());
System.out.println("Here");
}
}
这是输出。看起来非常相似:https : //docs.google.com/leaf?id=0B4MxFm-
ACB3IYzdhZWIwNWEtYjUzMS00NGM5LWEzZjQtYzMzOWE3MWNhYWQ0&hl=zh_CN&authkey=CJ-
Lv_wGG
编辑2:
这是我的gcore输出附加到该过程中..不知道这是在告诉我什么:
(no debugging symbols found)(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 0xb7fb26c0 (LWP 8326)]
[New Thread 0x7fa8eb90 (LWP 8340)]
[New Thread 0x7fe2db90 (LWP 8339)]
[New Thread 0x7fe7eb90 (LWP 8338)]
[New Thread 0x7feffb90 (LWP 8337)]
[New Thread 0x800afb90 (LWP 8336)]
[New Thread 0x80100b90 (LWP 8335)]
[New Thread 0x80351b90 (LWP 8334)]
[New Thread 0x803a2b90 (LWP 8333)]
[New Thread 0x80423b90 (LWP 8332)]
[New Thread 0x8066db90 (LWP 8331)]
[New Thread 0x806eeb90 (LWP 8330)]
[New Thread 0x8076fb90 (LWP 8329)]
[New Thread 0x807f0b90 (LWP 8328)]
[New Thread 0xb7474b90 (LWP 8327)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
0xb7fcd402 in __kernel_vsyscall ()
Saved corefile core.8326
回答:
如果我不得不猜测,我会说可能的罪魁祸首是共享库的初始化代码。
(使用gcore
)gdb
获取JVM进程的核心转储,或进行附加操作以获取确切冻结位置的堆栈跟踪。
以上是 Linux上的Java System.loadLibrary调用冻结 的全部内容, 来源链接: utcz.com/qa/421936.html