Giter Site home page Giter Site logo

Comments (10)

codingtony avatar codingtony commented on July 18, 2024

This code has the same problem :

        PcapHandle h = Pcaps.openOffline(pcapFilename);
        h.loop(0, new PacketListener() {
            long nbPackets=0;
            @Override
            public void gotPacket(Packet p) {
                UdpPacket up = p.get(UdpPacket.class);
                if (up != null) {
                    System.out.println(nbPackets++ + " " + p.toString());
                }
            }
        });

from pcap4j.

kaitoy avatar kaitoy commented on July 18, 2024

PcapHandle doesn't hold any packets. Anyway it seems someone (packet classes, jna, or stuff) leaks memory. I will investigate it.

from pcap4j.

kaitoy avatar kaitoy commented on July 18, 2024

I tried your code with my pcap file including 600000 UDP packets but I couldn't reproduce the OOM.
Can I try with your pcap file?

from pcap4j.

codingtony avatar codingtony commented on July 18, 2024

I can't, the pcap file contain some sensitive information. I finally used the Perl lib Net::Pcap to extract the data from the file without problem. If I have a non-private data to share, I will.

from pcap4j.

codingtony avatar codingtony commented on July 18, 2024

What version of JRE you use?

I use :

java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

on Ubuntu 14.04 LTS

from pcap4j.

kaitoy avatar kaitoy commented on July 18, 2024

I tried it with
java version "1.7.0_21"
OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-1ubuntu1)
OpenJDK Server VM (build 23.7-b01, mixed mode)
on Ubuntu 13.04 but no error occured.
Can I see the OOM error message you saw?

from pcap4j.

codingtony avatar codingtony commented on July 18, 2024

Hi Kaitoy,

It looks like the problem occurs only when I run within Eclipse (It crashes my workspace most of the time when the number of packets are high).

I use Eclipse 4.4 (Luna) with a lot of plugins installed.

Can you try to run in Eclipse with a significant amount of packets?

When I inspect with jvisualvm I see a lot of LazyValue and char[] that does not seem to be freed over time.

However, I did the same test on the command line (without Eclipse) and there was no memory problem.

I'm not sure what is the exact root cause of the OOM, but I think that you can close the issue.

Thanks for your time.

from pcap4j.

kaitoy avatar kaitoy commented on July 18, 2024

I ran it on Eclipse Kepler but no error. And when I monitored memory usage and objects with jvisualvm while reading a huge pcap file, it looked all objects including LazyValue and char[] are properly GCed.
So, let me close this ticket without changes.

from pcap4j.

omidvd79 avatar omidvd79 commented on July 18, 2024

happend to me as well on MAC.
try packet = h.getNextPacketEx(); see if it helps.

from pcap4j.

crowlogic avatar crowlogic commented on July 18, 2024

why was this closed? I still get this with pcap4j , lots of LazyValue objects not being freed. happens with both loop function and iterate with readPacketEx. If you want example files, see this for example. From https://iextrading.com/trading/market-data/#tops

https://www.googleapis.com/download/storage/v1/b/iex/o/data%2Ffeeds%2F20190808%2F20190808_IEXTP1_TOPS1.6.pcap.gz?generation=1565312136721342&alt=media

from pcap4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.