[ixpmanager] SFLOW Under Reporting?

Ian Chilton ian at lonap.net
Wed Jun 28 07:54:18 IST 2023


Hi,

We are now running this in production and it's still working great 
graphs wise, however there is a bit of a problem... it's caused a memory 
leak.

I assume when each thread ends it's not then freeing up the memory after 
itself, so it just grows and grows.

ichilton at sflow:~$ free -m
                total        used        free      shared  buff/cache   
available
Mem:            7943        4128         264           0        3551     
    3516
Swap:              0           0           0

ichilton at sflow:~$ ps -o pid,user,%mem,command ax | sort -b -k3 -r | grep 
rrd
    3935 root     41.1 perl 
/srv/ixpmanager/tools/runtime/sflow/sflow-to-rrd-handler
     631 root      1.5 /usr/bin/rrdcached -P STATS,FLUSH,UPDATE,FLUSHALL 
-F -m 0666 -w 60 -z 30 -t 4 -b /var/lib/rrdcached/db/ -p 
/var/run/rrdcached.pid -l unix:/var/run/rrdcached.sock

Anyone have experience with threads in Perl and able to suggest why?

I've tried changing it to do a detach after creating the thread (which 
is the alternative to join(), which would block execution of the main 
loop again), but it didn't seem to help:

         $thread = threads->create('process_rrd', $interval, $matrix, 
$rrdcached);
         $thread->detach();

Wondering if I need to keep track of the threads it creates and "later" 
clean them up... it needs to detect when they are finished though.

Anyone have any ideas to save me going down another rabbit hole?

So close..!

Ian


On 2023-06-27 10:18, Ian Chilton wrote:
> Added `use threads;` and did this 1 line fix:
> -               process_rrd($interval, $matrix, $rrdcached);
> +               threads->create('process_rrd', $interval, $matrix, 
> $rrdcached);
> Bingo!


More information about the ixpmanager mailing list