4.1.2 Crash in Native Code
If the fatal error log indicates that the crash was in a native library, there might be a bug in native code or JNI library code. The crash could of course be caused by something else, but analysis of the library and any core file or crash dump is a good starting place. For example, consider the following extract from the header of a fatal error log:
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# SIGSEGV (0xb) at pc=0x417789d7, pid=21139, tid=1024
#
# Java VM: Java HotSpot(TM) Server VM (6-beta2-b63 mixed mode)
# Problematic frame:
# C [libApplication.so+0x9d7]
In this case a SIGSEGV occurred with a thread executing in the library libApplication.so.
In some cases a bug in a native library manifests itself as a crash in Java VM code. Consider the following crash where a JavaThread fails while in the _thread_in_vm state (meaning that it is executing in Java VM code) :
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x08083d77, pid=3700, tid=2896
#
# Java VM: Java HotSpot(TM) Client VM (1.5-internal mixed mode)
# Problematic frame:
# V [jvm.dll+0x83d77]
--------------- T H R E A D ---------------
Current thread (0x00036960): JavaThread "main" [_thread_in_vm, id=2896]
:
Stack: [0x00040000,0x00080000), sp=0x0007f9f8, free space=254k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [jvm.dll+0x83d77]
C [App.dll+0x1047]
結果 (
日本語) 1:
[コピー]コピーしました!
4.1.2 ネイティブ コードでクラッシュします。致命的なエラー ログは、クラッシュは、ネイティブ ライブラリを示します、JNI ライブラリ コードまたはネイティブ コードのバグあるありますかもしれないが。クラッシュ コースの可能性があります他の何かによってが、ライブラリと、コア ・ ファイルまたはクラッシュ ダンプの分析はよい開始の場所。たとえば、以下の致命的なエラー ログのヘッダーの抜粋を考えてみます。# HotSpot 仮想マシンによって予期しないエラーが検出されました。## Pc で SIGSEGV (0 xb) = 0x417789d7, pid = 21139、tid = 1024年## Java VM: Java 実際サーバー VM (6 beta2 b63 混在モード)# 問題のあるフレーム:# C [libApplication.so+0x9d7]この場合、SIGSEGV はライブラリ libApplication.so で実行するスレッドで発生しました。いくつかのケースでネイティブ ライブラリのバグは Java VM コードでクラッシュとしてそれ自身を明示します。次のクラッシュ、JavaThread が _thread_in_vm 状態 (つまり、Java VM コードで実行している) で失敗した場合を考慮してください。# HotSpot 仮想マシンによって予期しないエラーが検出されました。## Pc で参照 (0xc0000005) = 0x08083d77, pid = 3700、tid = 2896年## Java VM: Java 実際クライアント VM (1.5 内部混合モード)# 問題のあるフレーム:# V [jvm.dll+0x83d77]--------------- T H R E A D ---------------現在のスレッド (0x00036960): JavaThread「メイン」[_thread_in_vm、id = 2896年] :スタック: [0x00040000、0x00080000) sp 0x0007f9f8、空き領域を = = 254 kネイティブ フレーム: (J、コンパイルされた Java コードを = j = 解釈、Vv = VM コード, C = ネイティブ コード)V [jvm.dll+0x83d77]C [App.dll+0x1047] <========= C/native framej Test.foo()V+0j Test.main([Ljava/lang/String;)V+0v ~StubRoutines::call_stubV [jvm.dll+0x80f13]V [jvm.dll+0xd3842]V [jvm.dll+0x80de4]V [jvm.dll+0x87cd2]C [java.exe+0x14c0]C [java.exe+0x64cd]C [kernel32.dll+0x214c7] :In this case the stack trace shows that a native routine in App.dll has called into the VM (probably with JNI).If you get a crash in a native application library (as in the above examples), then you might be able to attach the native debugger to the core file or crash dump, if it is available. Depending on the operating system, the native debugger is dbx, gdb, or windbg.Another approach is to run with the -Xcheck:jni option added to the command line (see B.2.1 -Xcheck:jni Option ). This option is not guaranteed to find all issues with JNI code, but it can help identify a significant number of issues.If the native library where the crash occurred is part of the Java runtime environment (for example awt.dll, net.dll, and so forth), then it is possible that you have encountered a library or API bug. If after further analysis you conclude this is a library or API bug, then gather a much data as possible and submit a bug or support call. See Chapter 7, Submitting Bug Reports.
翻訳されて、しばらくお待ちください..
