gpt4 book ai didi

java - Jpcap 破坏 JVM

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:57:43 24 4
gpt4 key购买 nike

我编写了以下程序,旨在将所有网络设备流量转储到一个文件中。我知道问题涉及 JpcapWriter 的使用。为什么我会收到如下所示的错误消息?

import jpcap.*;
import jpcap.packet.*;

public class dumptraffic
{
private static final int maxPackets = 100;

public static void main(String args[])
{
try
{
NetworkInterface[] devices = JpcapCaptor.getDeviceList();

if (args.length != 1)
{
System.out.println("You must enter a device number.");

int i = 0;
for (NetworkInterface device : devices)
System.out.println((i++) + ": " + device.name);

return;
}

JpcapCaptor jpcap = JpcapCaptor.openDevice(devices[Integer.parseInt(args[0].trim())], 2000, false, 20);
JpcapWriter writer = JpcapWriter.openDumpFile(jpcap, "dump.pcap");

for (int i = 0; i < maxPackets; i++)
writer.writePacket(jpcap.getPacket());

writer.close();

System.out.println("Recorded packets to the file \"dump.pcap\"");
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}

}

这是 Java 转储的日志:

#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0234659d, pid=4900, tid=5808
#
# JRE version: 6.0_22-b04
# Java VM: Java HotSpot(TM) Client VM (17.1-b03 mixed mode, sharing windows-x86 )
# Problematic frame:
# v ~BufferBlob::jni_fast_GetLongField
#
# 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 (0x02211c00): JavaThread "main" [_thread_in_native, id=5808, stack(0x002f0000,0x00340000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x00000000

Registers:
EAX=0x00000000, EBX=0x6da511e8, ECX=0x00000000, EDX=0x00000000
ESP=0x0033f578, EBP=0x0033f5b0, ESI=0x00000022, EDI=0x00000000
EIP=0x0234659d, EFLAGS=0x00010246

Top of Stack: (sp=0x0033f578)
0x0033f578: 02211d18 6d97567f 02211d18 00000000
0x0033f588: 00000022 00000000 02211d18 6da511e8
0x0033f598: 0033f58c 0033f19c 0033fd8c 6d9f4ed0
0x0033f5a8: 6da2a4b0 00000000 0033fc68 015d358c
0x0033f5b8: 02211d18 00000000 00000022 02211c00
0x0033f5c8: 380655e0 0033fc68 380655e0 0000005b
0x0033f5d8: 00000000 03000003 001521a8 77a94460
0x0033f5e8: 00000000 77a94460 00000000 001219b8

Instructions: (pc=0x0234659d)
0x0234658d: 00 00 00 8b c1 83 e0 01 8b 54 04 0c 8b 74 24 10
0x0234659d: 8b 12 c1 ee 02 8b 04 32 8b 54 32 04 be e0 16 a6


Stack: [0x002f0000,0x00340000], sp=0x0033f578, free space=13d0033f0ack
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
v ~BufferBlob::jni_fast_GetLongField
C [Jpcap.dll+0x358c]
j dumptraffic.main([Ljava/lang/String;)V+127
v ~StubRoutines::call_stub
V [jvm.dll+0xf3a9c]
V [jvm.dll+0x186591]
V [jvm.dll+0xf3b1d]
V [jvm.dll+0xfd365]
V [jvm.dll+0x104fbd]
C [java.exe+0x2155]
C [java.exe+0x85b4]
C [kernel32.dll+0x4d0e9]
C [ntdll.dll+0x419bb]
C [ntdll.dll+0x4198e]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j jpcap.JpcapWriter.writePacket(Ljpcap/packet/Packet;)V+0
j dumptraffic.main([Ljava/lang/String;)V+127
v ~StubRoutines::call_stub

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

Java Threads: ( => current thread )
0x02245800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2888, stack(0x04550000,0x045a0000)]
0x0223e400 JavaThread "CompilerThread0" daemon [_thread_blocked, id=2620, stack(0x04500000,0x04550000)]
0x0223d400 JavaThread "Attach Listener" daemon [_thread_blocked, id=4060, stack(0x044b0000,0x04500000)]
0x0223a400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=4280, stack(0x04460000,0x044b0000)]
0x02232000 JavaThread "Finalizer" daemon [_thread_blocked, id=5952, stack(0x04410000,0x04460000)]
0x02230c00 JavaThread "Reference Handler" daemon [_thread_blocked, id=5860, stack(0x008c0000,0x00910000)]
=>0x02211c00 JavaThread "main" [_thread_in_native, id=5808, stack(0x002f0000,0x00340000)]

Other Threads:
0x0222f400 VMThread [stack: 0x003b0000,0x00400000] [id=4396]
0x0224f400 WatcherThread [stack: 0x045a0000,0x045f0000] [id=4156]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
def new generation total 4928K, used 371K [0x28050000, 0x285a0000, 0x2d5a0000)
eden space 4416K, 8% used [0x28050000, 0x280acf00, 0x284a0000)
from space 512K, 0% used [0x284a0000, 0x284a0000, 0x28520000)
to space 512K, 0% used [0x28520000, 0x28520000, 0x285a0000)
tenured generation total 10944K, used 0K [0x2d5a0000, 0x2e050000, 0x38050000)
the space 10944K, 0% used [0x2d5a0000, 0x2d5a0000, 0x2d5a0200, 0x2e050000)
compacting perm gen total 12288K, used 86K [0x38050000, 0x38c50000, 0x3c050000)
the space 12288K, 0% used [0x38050000, 0x38065868, 0x38065a00, 0x38c50000)
ro space 10240K, 51% used [0x3c050000, 0x3c57baf8, 0x3c57bc00, 0x3ca50000)
rw space 12288K, 54% used [0x3ca50000, 0x3d0e76d8, 0x3d0e7800, 0x3d650000)

Dynamic libraries:
0x00400000 - 0x00424000 C:\Windows\system32\java.exe
0x779d0000 - 0x77af7000 C:\Windows\system32\ntdll.dll
0x77700000 - 0x777dc000 C:\Windows\system32\kernel32.dll
0x761c0000 - 0x76286000 C:\Windows\system32\ADVAPI32.dll
0x76460000 - 0x76523000 C:\Windows\system32\RPCRT4.dll
0x10000000 - 0x10048000 C:\Windows\system32\guard32.dll
0x76950000 - 0x769ed000 C:\Windows\system32\USER32.dll
0x77be0000 - 0x77c2b000 C:\Windows\system32\GDI32.dll
0x75f00000 - 0x75f08000 C:\Windows\system32\VERSION.dll
0x77500000 - 0x775aa000 C:\Windows\system32\msvcrt.dll
0x77b60000 - 0x77b7e000 C:\Windows\system32\IMM32.DLL
0x76880000 - 0x76948000 C:\Windows\system32\MSCTF.dll
0x77b10000 - 0x77b19000 C:\Windows\system32\LPK.DLL
0x76290000 - 0x7630d000 C:\Windows\system32\USP10.dll
0x75ef0000 - 0x75ef7000 C:\Windows\system32\fltlib.dll
0x7c340000 - 0x7c396000 C:\Program Files\Java\jre6\bin\msvcr71.dll
0x6d7f0000 - 0x6da97000 C:\Program Files\Java\jre6\bin\client\jvm.dll
0x74900000 - 0x74932000 C:\Windows\system32\WINMM.dll
0x775b0000 - 0x776f5000 C:\Windows\system32\ole32.dll
0x763d0000 - 0x7645d000 C:\Windows\system32\OLEAUT32.dll
0x748c0000 - 0x748fd000 C:\Windows\system32\OLEACC.dll
0x75ec0000 - 0x75eec000 C:\Windows\system32\apphelp.dll
0x6d7a0000 - 0x6d7ac000 C:\Program Files\Java\jre6\bin\verify.dll
0x6d320000 - 0x6d33f000 C:\Program Files\Java\jre6\bin\java.dll
0x6d280000 - 0x6d288000 C:\Program Files\Java\jre6\bin\hpi.dll
0x76070000 - 0x76077000 C:\Windows\system32\PSAPI.DLL
0x6d7e0000 - 0x6d7ef000 C:\Program Files\Java\jre6\bin\zip.dll
0x015d0000 - 0x015f8000 C:\Windows\System32\Jpcap.dll
0x763a0000 - 0x763cd000 C:\Windows\system32\WS2_32.dll
0x77b20000 - 0x77b26000 C:\Windows\system32\NSI.dll
0x045f0000 - 0x0463c000 C:\Windows\system32\wpcap.dll
0x00920000 - 0x00938000 C:\Windows\system32\packet.dll
0x75980000 - 0x75999000 C:\Windows\system32\iphlpapi.dll
0x75940000 - 0x75975000 C:\Windows\system32\dhcpcsvc.DLL
0x75e70000 - 0x75e9c000 C:\Windows\system32\DNSAPI.dll
0x75f10000 - 0x75f24000 C:\Windows\system32\Secur32.dll
0x75930000 - 0x75937000 C:\Windows\system32\WINNSI.DLL
0x75900000 - 0x75922000 C:\Windows\system32\dhcpcsvc6.DLL
0x6d600000 - 0x6d613000 C:\Program Files\Java\jre6\bin\net.dll
0x756f0000 - 0x7572b000 C:\Windows\system32\mswsock.dll
0x756e0000 - 0x756e5000 C:\Windows\System32\wship6.dll

VM Arguments:
java_command: dumptraffic 1
Launcher Type: SUN_STANDARD

Environment Variables:
CLASSPATH=.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Ruby192\bin;C:\Program Files\Java\jdk1.6.0_20\bin
USERNAME=Donald Taylor
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 13, GenuineIntel



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

OS: Windows Vista Build 6002 Service Pack 2

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

Memory: 4k page, physical 2094396k(1168912k free), swap 4458364k(3080400k free)

vm_info: Java HotSpot(TM) Client VM (17.1-b03) for windows-x86 JRE (1.6.0_22-b04), built on Sep 15 2010 00:56:36 by "java_re" with MS VC++ 7.1 (VS2003)

time: Mon Nov 08 19:50:43 2010
elapsed time: 0 seconds

最佳答案

我没有办法解决你的问题,但你可能会在 jpcap discussion board 上找到一个在 Google 网上论坛。

浏览消息(关键字“jvm crash”)后,我注意到有人说问题原来是调用了一个带有错误参数的方法。因此,您可以尝试仔细检查您的代码是否正确使用了 API。

我不会将此报告给 Sun/Oracle。故障转储中的证据表明某些东西使用 JNI 的方式存在错误。

关于java - Jpcap 破坏 JVM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4129934/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com