eclipse-ecal / ecal

📦 eCAL - enhanced Communication Abstraction Layer. A high performance publish-subscribe, client-server cross-plattform middleware.
https://ecal.io
Apache License 2.0
848 stars 178 forks source link

Ram usage is increasing continuously while running ecal python code #1609

Open prakhar114 opened 6 months ago

prakhar114 commented 6 months ago

Problem Description

When I try to run ecal webcam_grabber.py from ecal-camera-samples/ecal_camera_send_python , the ram keeps on increasing and then if i keep running it for longer time,ram gets filled up completely.

Ram usage before running the webcam_grabber.py Ram usage before running the webcam_grabber.py

Ram usage after running webcam_grabber.py for 5 min Ram usage after running webcam_grabber.py for 5 min

ecal monitor

Protobuff packet size is ~0.6MB

How to reproduce

clone this repo https://github.com/eclipse-ecal/ecal-camera-samples follow the python setup code in Readme connect a full hd(1920,1080) camera via usb (/dev/video0) run the webcam_grabber.py --compressed

Protobuff packet size is ~0.6MB

How did you get eCAL?

Download from Release Page

Environment

eCAL System Information

------------------------- SYSTEM ---------------------------------
Version                  : v5.12.5 (2024-04-24 14:43:08 +0200)
Platform                 : linux

------------------------- CONFIGURATION --------------------------
Default INI              : /etc/ecal/ecal.ini

------------------------- NETWORK --------------------------------
Host name                : car
Host group name          : car
Network mode             : local
Network ttl              : 2
Network sndbuf           : 5 MByte
Network rcvbuf           : 5 MByte
Multicast cfg version    : v1
Multicast group          : 239.0.0.1
Multicast mask           : 0.0.0.15
Multicast ports          : 14000 - 14010
Multicast join all IFs   : off
Bandwidth limit (udp)    : not limited

------------------------- TIME -----------------------------------
Synchronization realtime : "ecaltime-localtime"
Synchronization replay   : 
State                    :  synchronized 
Master / Slave           :  Master 
Status (Code)            : "everything is fine." (0)

------------------------- PUBLISHER LAYER DEFAULTS ---------------
Layer Mode INPROC        : off
Layer Mode SHM (ZEROCPY) : auto
Layer Mode TCP           : off
Layer Mode UDP MC        : auto

------------------------- SUBSCRIPTION LAYER DEFAULTS ------------
Layer Mode INPROC        : on
Layer Mode SHM           : on
Layer Mode TCP           : on
Layer Mode UDP MC        : on
Npcap UDP Reciever       : off

------------------------- EXPERIMENTAL ---------------------------
SHM Monitoring           : off
SHM Monitoring (Domain)  : ecal_mon
SHM Monitoring (Queue)   : 1024
Network Monitoring       : on
Drop out-of-order msgs   : off
KerstinKeller commented 6 months ago

Hi, thanks for reporting. First we need to analyse, where this RAM build-up is coming from. It could come from the sample code itself (unlikely, since it's pure Python), from the eCAL binding, from Protobuf, or from opencv which is used to read the webcam images.

We can check pure eCAL samples (e.g. person_snd) to see if that builds up memory. Maybe also the VideoCapture is building up data, and not freeing it.

prakhar114 commented 6 months ago

Hello, I tested the following:-

Observation:-

prakhar114 commented 5 months ago

@Kerstin-Keller any possible solution/workaround to fix this issue?

Peguen commented 4 months ago

Hi @prakhar114 , sorry for the late answer. I now picked up this issue and wanted to reproduce the problem by

I did start the webcam app in the venv, and let everything run for 15-30 minutes. I could not see any increasing ram usage.

Then I modified the setup, like

Everytime with 5-15 minutes of monitoring. (Unfortunately?) There was never an increase in RAM usage visible, monitoring with htop.

So in order to debug your issue, could you please provide

I hope that we can find a solution soon together.