Skip Menu |

This queue is for tickets about the Net-NfDump CPAN distribution.

Report information
The Basics
Id: 104294
Status: resolved
Priority: 0/
Queue: Net-NfDump

People
Owner: TPODER [...] cpan.org
Requestors: fabrice [...] dulaunoy.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.08



Subject: Memory leak
Date: Thu, 7 May 2015 14:19:52 +0200
To: bug-Net-NfDump [...] rt.cpan.org
From: DULAUNOY Fabrice <fabrice [...] dulaunoy.com>
Hi All, I would like to report a small trouble with the module Net::NfDump. I did the test with Net::NfDump 1.07 and nfdump 1.62 and 1.63 (CentOS 6, CentOS 7, Debian SID) A memory leak occur in the module ( or maybe in the XS part ) when the query method is called. Here is the test to display the trouble: #!/usr/bin/perl use strict; use warnings; use Net::NfDump; open PID,'>', '/tmp/net-nfdump-mem.pid'; print PID "$$\n"; close PID; my $file = shift; while ( 1 ) { my $flow = new Net::NfDump( InputFiles => $file, Fields => [qw(srcip dstip)], ); $flow->query(); $flow->finish(); sleep 1; } I saved this code in the file net-nfdump-leak.pl Use like this: perl net-nfdump-leak.pl /a/nfcapd/file Follow the memory usage with: while [ 1 ] ; do ps h -o pid,rss,vsz,size -p $(cat /tmp/net-nfdump-mem.pid) ; sleep 4 ; done You could see the memory usage continuously increasing. The memory increase is not related to nfcapd file the size (same result with small or big file)nor with the number of Fields in use (2 like in that sample or 24 like in my real case) I would like to use the module in a long running daemon. For now I did a fork of the nfdump processing to avoid memory exhaustion, but this is not optimal. Best regards and thanks for your module. DULAUNOY Fabrice
Hi, thanks for precisely reported bug. Unfortunately the leak is deep in the original C nfdump source, so it will take a while to fix the problem. I hope the problem will be fixed in next release Net::NfDump which is planned for beginning of Jun. Tomas On Thu May 07 08:20:12 2015, FDULAU wrote: Show quoted text
> Hi All, > > I would like to report a small trouble with the module Net::NfDump. > I did the test with Net::NfDump 1.07 and nfdump 1.62 and 1.63 (CentOS > 6, CentOS 7, Debian SID) > A memory leak occur in the module ( or maybe in the XS part ) when the > query method is called. > > Here is the test to display the trouble: > > #!/usr/bin/perl > > use strict; > use warnings; > use Net::NfDump; > > open PID,'>', '/tmp/net-nfdump-mem.pid'; > print PID "$$\n"; > close PID; > > my $file = shift; > > while ( 1 ) > { > my $flow = new Net::NfDump( > InputFiles => $file, > Fields => [qw(srcip dstip)], > ); > $flow->query(); > $flow->finish(); > sleep 1; > } > > I saved this code in the file net-nfdump-leak.pl > > Use like this: > > perl net-nfdump-leak.pl /a/nfcapd/file > > Follow the memory usage with: > > while [ 1 ] ; do ps h -o pid,rss,vsz,size -p $(cat /tmp/net-nfdump- > mem.pid) ; sleep 4 ; done > > You could see the memory usage continuously increasing. > > The memory increase is not related to nfcapd file the size (same > result with small or big file)nor with the number of Fields in use (2 > like in that sample or 24 like in my real case) > > I would like to use the module in a long running daemon. > For now I did a fork of the nfdump processing to avoid memory > exhaustion, but this is not optimal. > > > Best regards and thanks for your module. > > DULAUNOY Fabrice
Hi, leak solved in 1.08. On Thu May 07 09:32:57 2015, TPODER wrote: Show quoted text
> Hi, > > thanks for precisely reported bug. Unfortunately the leak is deep in > the original C nfdump source, so it will take a while to fix the > problem. I hope the problem will be fixed in next release Net::NfDump > which is planned for beginning of Jun. > > Tomas > > > On Thu May 07 08:20:12 2015, FDULAU wrote:
> > Hi All, > > > > I would like to report a small trouble with the module Net::NfDump. > > I did the test with Net::NfDump 1.07 and nfdump 1.62 and 1.63 (CentOS > > 6, CentOS 7, Debian SID) > > A memory leak occur in the module ( or maybe in the XS part ) when > > the > > query method is called. > > > > Here is the test to display the trouble: > > > > #!/usr/bin/perl > > > > use strict; > > use warnings; > > use Net::NfDump; > > > > open PID,'>', '/tmp/net-nfdump-mem.pid'; > > print PID "$$\n"; > > close PID; > > > > my $file = shift; > > > > while ( 1 ) > > { > > my $flow = new Net::NfDump( > > InputFiles => $file, > > Fields => [qw(srcip dstip)], > > ); > > $flow->query(); > > $flow->finish(); > > sleep 1; > > } > > > > I saved this code in the file net-nfdump-leak.pl > > > > Use like this: > > > > perl net-nfdump-leak.pl /a/nfcapd/file > > > > Follow the memory usage with: > > > > while [ 1 ] ; do ps h -o pid,rss,vsz,size -p $(cat /tmp/net-nfdump- > > mem.pid) ; sleep 4 ; done > > > > You could see the memory usage continuously increasing. > > > > The memory increase is not related to nfcapd file the size (same > > result with small or big file)nor with the number of Fields in use (2 > > like in that sample or 24 like in my real case) > > > > I would like to use the module in a long running daemon. > > For now I did a fork of the nfdump processing to avoid memory > > exhaustion, but this is not optimal. > > > > > > Best regards and thanks for your module. > > > > DULAUNOY Fabrice