1

私のJavaアプリケーションでは、複数のスレッドが定期的にシステムの「プロセスリスト」をdll(ProcessDLL.dllという名前)を介して取得しています。アプリケーションにスレッドが 1 つしかない場合、正常に動作します。しかし、複数のスレッドを使用すると、EXCEPTION_ACCESS_VIOLATIONが発生します。これは DLL の実装の問題ですか、それとも複数のスレッドが dll にアクセスしようとする Java アプリケーションの問題ですか? 何か案は...

以下は私のエラーログです:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c9108d3, pid=2880, tid=1584
#
# JRE version: 6.0_16-b01
# Java VM: Java HotSpot(TM) Client VM (14.2-b01 mixed mode windows-x86 )
# Problematic frame:
# C  [ntdll.dll+0x108d3]
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x0a9c9800):  JavaThread "taskmgr" [_thread_in_native, id=1584, stack(0x0be70000,0x0bec0000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x656c6441

Registers:
EAX=0x656c6441, EBX=0x0b2f0178, ECX=0x656c6449, EDX=0x000001aa
ESP=0x0bebf778, EBP=0x0bebf834, ESI=0x0b3a31b0, EDI=0x0b2f0000
EIP=0x7c9108d3, EFLAGS=0x00010293

Top of Stack: (sp=0x0bebf778)
0x0bebf778:   0b2f21d0 0b3a3860 00000000 00000000
0x0bebf788:   0bebf76c 0b3a31b0 0b2f0178 7403c6dc
0x0bebf798:   0b3b3c50 ffffffff 74005087 74005bec
0x0bebf7a8:   0b3b0ff8 0b6e30b8 656c6441 00000000
0x0bebf7b8:   00000000 0bebf7f0 00000000 0b6e2fa8
0x0bebf7c8:   0b2a1ef8 6a957160 656c6449 000006a8
0x0bebf7d8:   0b6e7740 00000001 0b712c98 00000035
0x0bebf7e8:   0bebf80c 7400605b 0b3b0ff8 74004866 

Instructions: (pc=0x7c9108d3)
0x7c9108c3:   d9 74 16 8d 41 f8 89 85 7c ff ff ff 66 8b 55 e4
0x7c9108d3:   66 3b 10 0f 87 93 fe ff ff 8d 46 08 89 85 64 ff 


Stack: [0x0be70000,0x0bec0000],  sp=0x0bebf778,  free space=317k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [ntdll.dll+0x108d3]
C  [ProcessDLL.dll+0x127a2]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  process.info.NTProcessWin32.jniGetProcessInfosN([Ljava/lang/String;J)[Lprocess/info/NTProcess;+0
j  process.info.NTProcessWin32.getProcessInfos([Ljava/lang/String;J)[Lprocess/info/NTProcess;+9
j  process.info.InstanceController.getAndSetProcesses()V+17
j  process.info.ControllerImpl$UpdateGraphTimer.run()V+7
j  java.util.TimerThread.mainLoop()V+221
j  java.util.TimerThread.run()V+1
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x003a7000 JavaThread "DestroyJavaVM" [_thread_blocked, id=1288, stack(0x00840000,0x00890000)]
=>0x0a9c9800 JavaThread "taskmgr" [_thread_in_native, id=1584, stack(0x0be70000,0x0bec0000)]
  0x0afb8400 JavaThread "notepad" [_thread_blocked, id=3408, stack(0x0be20000,0x0be70000)]
  0x0aee8800 JavaThread "mspaint" [_thread_blocked, id=3188, stack(0x0bdd0000,0x0be20000)]
  0x0aee7400 JavaThread "mmc" [_thread_blocked, id=3196, stack(0x0bd80000,0x0bdd0000)]
  0x0aa5dc00 JavaThread "firefox" [_thread_blocked, id=1224, stack(0x0bd30000,0x0bd80000)]
  0x0b0b7c00 JavaThread "eclipse" [_thread_in_native, id=2628, stack(0x0bc80000,0x0bcd0000)]
  0x0b7e4400 JavaThread "cmd" [_thread_blocked, id=3804, stack(0x0bc30000,0x0bc80000)]
  0x0b7e0800 JavaThread "7zFM" [_thread_blocked, id=296, stack(0x0bbe0000,0x0bc30000)]
  0x0b0b5000 JavaThread "Keep-Alive-Timer" daemon [_thread_blocked, id=3724, stack(0x0b790000,0x0b7e0000)]
  0x0af9cc00 JavaThread "Thread-1" daemon [_thread_blocked, id=244, stack(0x0b0c0000,0x0b110000)]
  0x0aa5a800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=1480, stack(0x0ae20000,0x0ae70000)]
  0x0aa57400 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3656, stack(0x0add0000,0x0ae20000)]
  0x0aa52800 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=3756, stack(0x0ad80000,0x0add0000)]
  0x0aa47400 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=3672, stack(0x0ad30000,0x0ad80000)]
  0x0aa44c00 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_blocked, id=3500, stack(0x0ace0000,0x0ad30000)]
  0x0aa39c00 JavaThread "Attach Listener" daemon [_thread_blocked, id=3660, stack(0x0abf0000,0x0ac40000)]
  0x0aa38800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2604, stack(0x0aba0000,0x0abf0000)]
  0x0aa29400 JavaThread "Finalizer" daemon [_thread_blocked, id=1628, stack(0x0ab50000,0x0aba0000)]
  0x0aa24c00 JavaThread "Reference Handler" daemon [_thread_blocked, id=3940, stack(0x0ab00000,0x0ab50000)]

Other Threads:
  0x0aa20800 VMThread [stack: 0x0aab0000,0x0ab00000] [id=3048]
  0x0aa6e000 WatcherThread [stack: 0x0ae70000,0x0aec0000] [id=3232]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 960K, used 733K [0x02910000, 0x02a10000, 0x02df0000)
  eden space 896K,  74% used [0x02910000, 0x029b76a8, 0x029f0000)
  from space 64K,  99% used [0x02a00000, 0x02a0fff8, 0x02a10000)
  to   space 64K,   0% used [0x029f0000, 0x029f0000, 0x02a00000)
 tenured generation   total 4096K, used 3164K [0x02df0000, 0x031f0000, 0x06910000)
   the space 4096K,  77% used [0x02df0000, 0x031073c0, 0x03107400, 0x031f0000)
 compacting perm gen  total 12288K, used 8431K [0x06910000, 0x07510000, 0x0a910000)
   the space 12288K,  68% used [0x06910000, 0x0714bc90, 0x0714be00, 0x07510000)
No shared spaces configured.

Dynamic libraries:
0x00400000 - 0x00424000     C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe
0x7c900000 - 0x7c9b2000     C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c8f6000     C:\WINDOWS\system32\kernel32.dll
0x77dd0000 - 0x77e6b000     C:\WINDOWS\system32\ADVAPI32.dll
0x77e70000 - 0x77f03000     C:\WINDOWS\system32\RPCRT4.dll
0x77fe0000 - 0x77ff1000     C:\WINDOWS\system32\Secur32.dll
0x7e410000 - 0x7e4a1000     C:\WINDOWS\system32\USER32.dll
0x77f10000 - 0x77f59000     C:\WINDOWS\system32\GDI32.dll
0x76390000 - 0x763ad000     C:\WINDOWS\system32\IMM32.DLL
0x7c340000 - 0x7c396000     C:\Program Files\Java\jdk1.6.0_16\jre\bin\msvcr71.dll
0x6d8b0000 - 0x6db3b000     C:\Program Files\Java\jdk1.6.0_16\jre\bin\client\jvm.dll
0x76b40000 - 0x76b6d000     C:\WINDOWS\system32\WINMM.dll
0x6d860000 - 0x6d86c000     C:\Program Files\Java\jdk1.6.0_16\jre\bin\verify.dll
0x6d3e0000 - 0x6d3ff000     C:\Program Files\Java\jdk1.6.0_16\jre\bin\java.dll
0x6d340000 - 0x6d348000     C:\Program Files\Java\jdk1.6.0_16\jre\bin\hpi.dll
0x76bf0000 - 0x76bfb000     C:\WINDOWS\system32\PSAPI.DLL
0x6d430000 - 0x6d459000     C:\Program Files\Java\jdk1.6.0_16\jre\bin\jdwp.dll
0x6d750000 - 0x6d756000     C:\Program Files\Java\jdk1.6.0_16\jre\bin\npt.dll
0x6d8a0000 - 0x6d8af000     C:\Program Files\Java\jdk1.6.0_16\jre\bin\zip.dll
0x6d2b0000 - 0x6d2b7000     C:\Program Files\Java\jdk1.6.0_16\jre\bin\dt_socket.dll
0x71ab0000 - 0x71ac7000     C:\WINDOWS\system32\WS2_32.dll
0x77c10000 - 0x77c68000     C:\WINDOWS\system32\msvcrt.dll
0x71aa0000 - 0x71aa8000     C:\WINDOWS\system32\WS2HELP.dll
0x71a50000 - 0x71a8f000     C:\WINDOWS\System32\mswsock.dll
0x76f20000 - 0x76f47000     C:\WINDOWS\system32\DNSAPI.dll
0x76d60000 - 0x76d79000     C:\WINDOWS\system32\iphlpapi.dll
0x76fb0000 - 0x76fb8000     C:\WINDOWS\System32\winrnr.dll
0x76f60000 - 0x76f8c000     C:\WINDOWS\system32\WLDAP32.dll
0x76fc0000 - 0x76fc6000     C:\WINDOWS\system32\rasadhlp.dll
0x662b0000 - 0x66308000     C:\WINDOWS\system32\hnetcfg.dll
0x71a90000 - 0x71a98000     C:\WINDOWS\System32\wshtcpip.dll
0x10000000 - 0x1003b000     C:\DATA\ProcessDLL.dll
0x74000000 - 0x74056000     C:\WINDOWS\system32\pdh.dll
0x763b0000 - 0x763f9000     C:\WINDOWS\system32\comdlg32.dll
0x773d0000 - 0x774d3000     C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\COMCTL32.dll
0x77f60000 - 0x77fd6000     C:\WINDOWS\system32\SHLWAPI.dll
0x7c9c0000 - 0x7d1d7000     C:\WINDOWS\system32\SHELL32.dll
0x77a80000 - 0x77b15000     C:\WINDOWS\system32\CRYPT32.dll
0x77b20000 - 0x77b32000     C:\WINDOWS\system32\MSASN1.dll
0x74320000 - 0x7435d000     C:\WINDOWS\system32\ODBC32.dll
0x711a0000 - 0x711a6000     C:\WINDOWS\system32\odbcbcp.dll
0x77c00000 - 0x77c08000     C:\WINDOWS\system32\VERSION.dll
0x774e0000 - 0x7761e000     C:\WINDOWS\system32\ole32.dll
0x77120000 - 0x771ab000     C:\WINDOWS\system32\OLEAUT32.dll
0x73000000 - 0x73026000     C:\WINDOWS\system32\WINSPOOL.DRV
0x0b280000 - 0x0b297000     C:\WINDOWS\system32\odbcint.dll
0x5e750000 - 0x5e75d000     C:\WINDOWS\system32\perfproc.dll
0x6d6c0000 - 0x6d6d3000     C:\Program Files\Java\jdk1.6.0_16\jre\bin\net.dll

VM Arguments:
jvm_args: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:1349 -Dfile.encoding=UTF-8 
java_command: process.info.MainClass
Launcher Type: SUN_STANDARD

Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_16
PATH=C:\Program Files\Java\jdk1.6.0_16\jre\bin;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Java\jdk1.6.0_16\bin;C:\Program Files\Ant\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\NSIS;;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\WINDOWS\system32\WindowsPowerShell\v1.0
USERNAME=Administrator
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 42 Stepping 7, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows XP Build 2600 Service Pack 3

CPU:total 2 (1 cores per cpu, 1 threads per core) family 6 model 42 stepping 7, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2

Memory: 4k page, physical 2096620k(1088228k free), swap 4036496k(3130120k free)

vm_info: Java HotSpot(TM) Client VM (14.2-b01) for windows-x86 JRE (1.6.0_16-b01), built on Jul 31 2009 11:26:58 by "java_re" with MS VC++ 7.1

time: Wed Apr 04 11:15:02 2012
elapsed time: 30 seconds
4

1 に答える 1

4

PrecessDLL.dll はスレッドセーフではないと思います。コードに一度だけアクセスするには、コードを同期する必要があります。または、ProcessDLL.dll をマルチスレッド セーフに修正する必要があります。

JVM (1.6.16 はかなり古い) を更新することもできますが、このバージョンがエラーにつながるとは思いません。

アップデート

# クラッシュは、ネイティブ コードの Java 仮想マシンの外部で発生しました。

(私の観点から) より良いアプローチは、DLL を修正することです。

于 2012-04-04T10:25:15.633 に答える