JpCapWriter崩溃JVM [英] JpCapWriter crashes JVM

查看:375
本文介绍了JpCapWriter崩溃JVM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When I try to use JpCap Writer to save packets to a file, it causes JVM to crash.

代码:

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.
#



Any idea how to solve it? Or any other alternative way to save packets in TCPDump format?

推荐答案

我看到你对我的问题的评论。我有这个相同的问题,这是因为我试图关闭作者后,它已经关闭。你可能在不知不觉中关闭它。检查您的代码,并查看删除 writer.close(); 为您带来的效果。

I saw your comment on my question. I had this same problem and it was caused when I tried to close the writer after it had already been closed. You might be closing it unknowingly. Check your code, and also see what effect removing writer.close(); has for you.

不需要操作数据包,我建议使用 Wireshark 。这使得它很容易捕获数据包作为TCPDumps和添加捕获过滤器。

If you don't need to manipulate the packets, I would recommend using Wireshark. It makes it very easy to capture packets as TCPDumps and add capture filters.

这篇关于JpCapWriter崩溃JVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆