Open apsilva opened 1 day ago
Sounds like you just don't have enough cpu or gpu to do the ML. You may have to consider getting a gpu or tpu. Turn on debugging in zm and there should be lots of logs in /var/log/zm/zmesdetect*.log.
The cpu is around 25% usage, I've installed a coral usb TPU working in the mlapi. The object detection works fine after restarting everything, i notice that it stop working the next day, i don't see the notifications and what i could see so far is the stuck tasks.
I got more log search for each event in the logs:
/var/log/zm/web_php.log:Command was: /usr/bin/ffmpeg -ss 52.98 -i /home/zoneminder/events/1/2024-11-19/367172/incomplete.mp4 -frames:v 1 /home/zoneminder/events/1/2024-11-19/367172/00213-capture.jpg 2>&1
/var/log/zm/web_php.log:Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/zoneminder/events/1/2024-11-19/367172/incomplete.mp4':
/var/log/zm/web_php.log:Output #0, image2, to '/home/zoneminder/events/1/2024-11-19/367172/00213-capture.jpg':
/var/log/zm/web_php.log:Command was: /usr/bin/ffmpeg -ss 52.98 -i /home/zoneminder/events/1/2024-11-19/367172/incomplete.mp4 -frames:v 1 /home/zoneminder/events/1/2024-11-19/367172/00213-capture.jpg 2>&1
/var/log/zm/web_php.log:Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/zoneminder/events/1/2024-11-19/367172/incomplete.mp4':
/var/log/zm/web_php.log:Output #0, image2, to '/home/zoneminder/events/1/2024-11-19/367172/00213-capture.jpg':
/var/log/zm/web_php.log:Command was: /usr/bin/ffmpeg -ss 52.98 -i /home/zoneminder/events/1/2024-11-19/367172/incomplete.mp4 -frames:v 1 /home/zoneminder/events/1/2024-11-19/367172/00213-capture.jpg 2>&1
/var/log/zm/web_php.log:Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/zoneminder/events/1/2024-11-19/367172/incomplete.mp4':
/var/log/zm/web_php.log:Output #0, image2, to '/home/zoneminder/events/1/2024-11-19/367172/00213-capture.jpg':
/var/log/zm/zmc_m1.log:11/19/24 01:30:31.812812 zmc_m1[80410].INF-zm_monitor.cpp/2369 [Opened new event 367172 Continuous]
/var/log/zm/zmc_m1.log:11/19/24 01:40:31.460827 zmc_m1[80410].INF-zm_monitor.cpp/2321 [entrada: 24001 - Closing event 367172, section end forced 1731980431 - 1731979831 = 600 >= 600]
/var/log/zm/zmeventnotification.log:11/19/2024 01:31:23.745851 zmeventnotification[31559].INF [main:1406] [New event 367172 reported for Monitor:1 (Name:entrada) Continuous[last processed eid:367168]]
/var/log/zm/zmeventnotification.log:11/19/2024 01:40:43.750227 zmeventnotification[31559].INF [main:1406] [New event 367176 reported for Monitor:1 (Name:entrada) Continuous[last processed eid:367172]]
/var/log/zm/zmeventnotification.log:11/19/2024 08:47:30.850736 zmeventnotification[87716].INF [main:3693] [Event 367172 for Monitor 1 has finished]
/var/log/zm/zmc_m6.log:11/19/24 01:34:24.434337 zmc_m6[80751].INF-zm_monitor.cpp/2369 [Opened new event 367173 Continuous]
/var/log/zm/zmc_m6.log:11/19/24 01:44:24.203036 zmc_m6[80751].INF-zm_monitor.cpp/2321 [quartos: -01 - Closing event 367173, section end forced 1731980664 - 1731980064 = 600 >= 600]
/var/log/zm/zmeventnotification.log:11/19/2024 01:34:53.746111 zmeventnotification[31559].INF [main:1406] [New event 367173 reported for Monitor:6 (Name:quartos) Continuous[last processed eid:367169]]
/var/log/zm/zmeventnotification.log:11/19/2024 01:44:33.747037 zmeventnotification[31559].INF [main:1406] [New event 367177 reported for Monitor:6 (Name:quartos) Continuous[last processed eid:367173]]
/var/log/zm/zmeventnotification.log:11/19/2024 08:47:30.854259 zmeventnotification[87988].INF [main:3693] [Event 367173 for Monitor 6 has finished]
/var/log/zm/zmc_m3.log:11/19/24 01:40:30.080311 zmc_m3[80369].INF-zm_monitor.cpp/2369 [Opened new event 367175 Continuous]
/var/log/zm/zmc_m3.log:11/19/24 01:50:30.063981 zmc_m3[80369].INF-zm_monitor.cpp/2321 [garagem: 79352 - Closing event 367175, section end forced 1731981030 - 1731980430 = 600 >= 600]
/var/log/zm/zmeventnotification.log:11/19/2024 01:40:31.745927 zmeventnotification[31559].INF [main:1406] [New event 367175 reported for Monitor:3 (Name:garagem) Continuous[last processed eid:367171]]
/var/log/zm/zmeventnotification.log:11/19/2024 01:50:33.746573 zmeventnotification[31559].INF [main:1406] [New event 367179 reported for Monitor:3 (Name:garagem) Continuous[last processed eid:367175]]
/var/log/zm/zmeventnotification.log:11/19/2024 08:47:30.848438 zmeventnotification[88469].INF [main:3693] [Event 367175 for Monitor 3 has finished]
/var/log/zm/zmc_m7.log:11/19/24 01:40:14.148824 zmc_m7[80342].INF-zm_monitor.cpp/2369 [Opened new event 367174 Continuous]
/var/log/zm/zmc_m7.log:11/19/24 01:50:14.361763 zmc_m7[80342].INF-zm_monitor.cpp/2321 [AnexoPiscina: 132013 - Closing event 367174, section end forced 1731981014 - 1731980414 = 600 >= 600]
/var/log/zm/zmeventnotification.log:11/19/2024 01:40:41.745792 zmeventnotification[31559].INF [main:1406] [New event 367174 reported for Monitor:7 (Name:AnexoPiscina) Continuous[last processed eid:367170]]
/var/log/zm/zmeventnotification.log:11/19/2024 01:50:39.746055 zmeventnotification[31559].INF [main:1406] [New event 367178 reported for Monitor:7 (Name:AnexoPiscina) Continuous[last processed eid:367174]]
/var/log/zm/zmeventnotification.log:11/19/2024 08:47:30.854244 zmeventnotification[88476].INF [main:3693] [Event 367174 for Monitor 7 has finished]
I'm gonna to see how it behaves with the timeout change.
didn't solve the issue... my system stopped detecting objects but no locked process.
Before restarting all the services i manually try to run the detection with debug on a event and i had to kill the process, it was stuck on:
11/20/24 08:42:30 zmesdetect[239435] DBG1 zm_detect.py:71 [Invoking remote API login]
and in mlapi logs... nothing..
full log:
root@sala:~# /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini --eventid 367904 --debug
11/20/24 08:42:29 zmesdetect[239435] INF ZMLog.py:292 [Setting up signal handler for logs]
11/20/24 08:42:29 zmesdetect[239435] INF ZMLog.py:301 [Switching global logger to ZMLog]
11/20/24 08:42:29 zmesdetect[239435] DBG1 zm_detect.py:269 [---------| app:6.1.29, pyzm:0.3.62, ES:(?) , OpenCV:4.8.0|------------]
11/20/24 08:42:29 zmesdetect[239435] INF utils.py:404 [Reading config from: /etc/zm/objectconfig.ini]
11/20/24 08:42:29 zmesdetect[239435] INF utils.py:409 [Reading secrets from: /etc/zm/secrets.ini]
11/20/24 08:42:29 zmesdetect[239435] DBG2 utils.py:381 [Secret token found in config: !ZM_PORTAL]
11/20/24 08:42:29 zmesdetect[239435] DBG2 utils.py:381 [Secret token found in config: !ZM_USER]
11/20/24 08:42:29 zmesdetect[239435] DBG2 utils.py:381 [Secret token found in config: !ZM_PASSWORD]
11/20/24 08:42:29 zmesdetect[239435] DBG2 utils.py:381 [Secret token found in config: !ZM_API_PORTAL]
11/20/24 08:42:29 zmesdetect[239435] DBG2 utils.py:381 [Secret token found in config: !ML_USER]
11/20/24 08:42:29 zmesdetect[239435] DBG2 utils.py:381 [Secret token found in config: !ML_PASSWORD]
11/20/24 08:42:29 zmesdetect[239435] DBG2 utils.py:381 [Secret token found in config: !PLATEREC_ALPR_KEY]
11/20/24 08:42:29 zmesdetect[239435] DBG1 utils.py:444 [allowing self-signed certs to work...]
11/20/24 08:42:29 zmesdetect[239435] DBG2 utils.py:454 [Now checking for monitor overrides]
11/20/24 08:42:29 zmesdetect[239435] INF utils.py:509 [Ignoring monitor specific settings, as you did not provide a monitor id]
11/20/24 08:42:29 zmesdetect[239435] DBG3 utils.py:521 [Finally, doing parameter substitution]
11/20/24 08:42:29 zmesdetect[239435] DBG1 zm_detect.py:306 [Importing remote shim classes for Object/Face]
11/20/24 08:42:29 zmesdetect[239435] DBG2 api.py:69 [API SSL certificate check has been disbled]
11/20/24 08:42:29 zmesdetect[239435] DBG1 api.py:173 [using username/password for login]
11/20/24 08:42:30 zmesdetect[239435] DBG2 api.py:202 [Using new token API]
11/20/24 08:42:30 zmesdetect[239435] DBG1 api.py:209 [Access token expires on:2024-11-20 10:42:30.169840 [7200s]]
11/20/24 08:42:30 zmesdetect[239435] DBG1 api.py:213 [Refresh token expires on:2024-11-21 08:42:30.172668 [86400s]]
11/20/24 08:42:30 zmesdetect[239435] DBG2 zm_detect.py:333 [using ml_sequence]
11/20/24 08:42:30 zmesdetect[239435] DBG2 zm_detect.py:345 [using stream_sequence]
11/20/24 08:42:30 zmesdetect[239435] DBG1 zm_detect.py:40 [Detecting using remote API Gateway http://192.168.1.2:5000/api/v1]
11/20/24 08:42:30 zmesdetect[239435] DBG2 zm_detect.py:49 [Found token file, checking if token has not expired]
11/20/24 08:42:30 zmesdetect[239435] DBG1 zm_detect.py:65 [Found access token, but it has expired (or is about to expire)]
11/20/24 08:42:30 zmesdetect[239435] DBG1 zm_detect.py:71 [Invoking remote API login]
^C11/20/24 08:43:45 zmesdetect[239435] INF ZMLog.py:318 [Got interrupt, exiting]
After restarting the mlapi service everything is working ok. The mlapi.log was empty before the restart.. i suspect that is the log rotate that is causing the issue, what you think?
Recently i stop receiving events from zm and it was because the server reach maximum memory and linux start to kill process.. mysql was one of them...
The first time when i connect to the server i saw many zmeventnotification.pl process open:
all of them blocked at zm_detect.py:
I found the option to limit the maximum number of parallel_hooks and set it to 4
max_parallel_hooks=4
Now it gets block at 4 process.
that is correct and in zmeventnotification log we can see the cause and the parameter is preventing the system to fork more process:
That solve the issue about reaching the maximum of memory.. but i still got the initial problem, no objects detected...
Not sure if is the correct solution, but I made this change to set a maximum timeout to detect the object, using the command timeout to 30s for zm_detect.py to return a result:
I'm using MLAPI on a virtual env python3.9.18 , but the issue doesn't look related to the mlapi.
INFO about my setup:
How can i get more verbose to solve the root cause of the problem?
Thanks.