crash - JpCapWriter使JVM崩溃

标签 crash jvm writer jpcap

当我尝试使用JpCap Writer将数据包保存到文件时,它将导致JVM崩溃。

码:

captor=JpcapCaptor.openDevice(interfaceList[interfaceNumber], 65535, true, 20);
captor.setFilter("ip and tcp",true);


JpcapWriter writer=JpcapWriter.openDumpFile(captor,"write.txt");
for(int i=0;i<10;i++){
    Packet packet=captor.getPacket();
    writer.writePacket(packet);
  }
writer.close();

崩溃信息:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f283105953a, pid=3060, tid=139810797537024
#
# JRE version: 6.0_24-b24
# Java VM: OpenJDK 64-Bit Server VM (20.0-b12 mixed mode linux-amd64 compressed oops)
# Derivative: IcedTea6 1.11.4
# Distribution: Ubuntu 12.04 LTS, package 6b24-1.11.4-1ubuntu0.12.04.1
# Problematic frame:
# v  ~BufferBlob::jni_fast_GetLongField
#
# An error report file with more information is saved as:
# /root/workspace/Sniff/hs_err_pid3060.log
#
# If you would like to submit a bug report, please include
# instructions how to reproduce the bug and visit:
#   https://bugs.launchpad.net/ubuntu/+source/openjdk-6/
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

知道如何解决吗?或以其他方式将数据包保存为TCPDump格式吗?

最佳答案

我看到了你对我的问题的评论。我也遇到了同样的问题,这是由于我在关闭作家后试图将其关闭而引起的。您可能会在不知不觉中关闭它。检查您的代码,并查看删除writer.close();对您有什么影响。

如果您不需要操纵数据包,我建议使用Wireshark。它非常容易将数据包捕获为TCPDumps并添加捕获过滤器。

关于crash - JpCapWriter使JVM崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13088612/

相关文章:

java - 在 32 位平台上使用 Java DJNativeSwing 库时出现问题

java - 不关闭 BufferedWriter 的后果是什么

Java应用程序从本地包编写CSS

node.js - 如果我使用 send 或 json, Node 应用程序崩溃

c++ - 将 char 添加到字符串会导致 C++ 崩溃

java - 什么更快 : instanceof or isInstance?

java - BufferedReader 如何知道要读取哪个文件?

ios - _dispatch_call_block_and_release 崩溃

objective-c - Objective-C应用程序崩溃 “message sent to deallocated instance 0x..”

Java 时区在运行时更改