zmNinja icon indicating copy to clipboard operation
zmNinja copied to clipboard

zmNinja live view fills PATH_SWAP

Open euriam opened this issue 6 years ago • 20 comments

Dear,

I work at Serpro (Brazilian government IT company) and we use ZoneMinder + zmNinja in our environment.

We recently had the following recurring problem with some versions of zmNinja (1.3.66, 1.3.70, 1.3.74, 1.3.78, 1.3.79, 1.3.82): During monitoring, when images are zoomed in, temporary files are created in the PATH_SWAP directory until it is filled until the ZoneMinder service is paralyzed.

Before we figured it out, we had to clean up the directory often, but we're still unable to update the version (version 1.3.50 is in use today).

Has anyone experienced this problem or know what causes this malfunction?

Best Regards Euriam Araujo

euriam avatar Dec 10 '19 13:12 euriam

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you follow the issue template or I may not respond.

welcome[bot] avatar Dec 10 '19 13:12 welcome[bot]

By "zoom" are you referring to the zoom functionality inside zmNinja? Which screen? In zmNinja, zooming does not involve any network requests. The zooming is handled locally in CSS.

If you are referring to "Zoom" in zone minder web console, that is different.

pliablepixels avatar Dec 10 '19 13:12 pliablepixels

Thanks for the quick return. The functionality is within zmNinja and the zoom I refer to is, for example, when multiple cameras are being monitored simultaneously and one of them is selected, making the image full screen.

The version of zmNinja you are reporting: 1.3.66, 1.3.70, 1.3.74, 1.3.78, 1.3.79, 1.3.82

The version and OS of ZoneMinder you are using: OS: CentOS 7 ZoneMinder: 1.32.3

euriam avatar Dec 10 '19 14:12 euriam

Okay, so that is the monitor live view mode. How are you zooming? Are you using the "+" "-" of the desktop version? Like I said, when you zoom, it doesn't interact with ZM at all. It just scales up the image using CSS

pliablepixels avatar Dec 10 '19 14:12 pliablepixels

ok i hate to barge in on someone else but i think the same thing happening to me want to share.

When in live view, here im doing single full-screen mode either the desktop or iOS, the folder /tmp/zm grows rapidly with images until full. Zoom or size does not seem to make any difference as long in live. It does not happen via web-gui . i believe is related to not using nph-zms because of chrome, in doc: edit: ::shrug shoulders::, edit: URL https://zmninja.readthedocs.io/en/latest/guides/FAQ.html#zmninja-montage-does-not-seem-smooth-feeds-seem-a-little-delayed-compared-to-zm-console

zoneminder 1.32 on ubuntu server 16.04 nmninja 1.3.82 appimage on ubuntu desktop 18.04

here is the debug from zmninja, i think.. happy to help if there's anything else i can do let me know


filelogger.min.js:6 Dec 15, 2019 01:44:42 PM Arranging as per packery grid
filelogger.min.js:6 Dec 15, 2019 01:44:57 PM Cancelling montage timer, opening Modal
filelogger.min.js:6 Dec 15, 2019 01:44:57 PM Using stream mode single
filelogger.min.js:6 Dec 15, 2019 01:44:57 PM configurePTZ 1 is not PTZ controllable
filelogger.min.js:6 Dec 15, 2019 01:45:03 PM >>>Old image out
filelogger.min.js:6 Dec 15, 2019 01:45:03 PM configurePTZ 2 is not PTZ controllable
filelogger.min.js:6 Dec 15, 2019 01:45:03 PM <<<New image loaded in with ck:180216
filelogger.min.js:6 Dec 15, 2019 01:45:07 PM Invoking http://192.168.33.60/zm/api/monitors/alarm/id:2/command:status.json?
MonitorModalCtrl.js:425 ALARM = http://192.168.33.60/zm/api/monitors/alarm/id:2/command:status.json?
filelogger.min.js:6 Dec 15, 2019 01:45:08 PM >>>Old image out
filelogger.min.js:6 Dec 15, 2019 01:45:08 PM configurePTZ 3 is not PTZ controllable
filelogger.min.js:6 Dec 15, 2019 01:45:08 PM <<<New image loaded in with ck:56816
filelogger.min.js:6 Dec 15, 2019 01:45:13 PM >>>Old image out
filelogger.min.js:6 Dec 15, 2019 01:45:13 PM configurePTZ 1 is not PTZ controllable
filelogger.min.js:6 Dec 15, 2019 01:45:13 PM <<<New image loaded in with ck:184285
filelogger.min.js:6 Dec 15, 2019 01:45:17 PM Invoking http://192.168.33.60/zm/api/monitors/alarm/id:1/command:status.json?
MonitorModalCtrl.js:425 ALARM = http://192.168.33.60/zm/api/monitors/alarm/id:1/command:status.json?
filelogger.min.js:6 Dec 15, 2019 01:45:18 PM >>>Old image out
filelogger.min.js:6 Dec 15, 2019 01:45:18 PM configurePTZ 2 is not PTZ controllable
filelogger.min.js:6 Dec 15, 2019 01:45:18 PM <<<New image loaded in with ck:989539

mchoff avatar Dec 15 '19 18:12 mchoff

Okay, that's interesting. My /tmp/zm is empty but we may be on to something. I use muti-port while you likely don't.

Let's do this:

Step 1: a) Clear /tmp/zm b) Start zmNinja, go to Menu->Monitors c) Click on live view from one of the monitors there

Do you see /tmp/zm growing?

Step 2: a) Clear /tmp/zm b) Start zmNinja, go to Menu->Montage c) Stay there

Do you see /tmp/zm growing?

Step 3: a) Clear /tmp/zm b) Start zmNinja, go to Menu->Montage c) Click on live view

Do you see /tmp/zm growing? (I assume yes)

pliablepixels avatar Dec 15 '19 19:12 pliablepixels

  1. YES. from monitors menu to live view button.
  2. NO. hanging out on montage
  3. YES. from montage to live.

Im not sure what multi-port is in this aspect, so ill assume for now that i dont use it.

Edit: I read up on Multi-port and surely do not do that now, however, it is very interesting and something i can look into. It seems related to this issue and somewhat a workaround.

Okay, that's interesting. My /tmp/zm is empty but we may be on to something. I use muti-port while you likely don't.

Let's do this:

Step 1: a) Clear /tmp/zm b) Start zmNinja, go to Menu->Monitors c) Click on live view from one of the monitors there

Do you see /tmp/zm growing?

Step 2: a) Clear /tmp/zm b) Start zmNinja, go to Menu->Montage c) Stay there

Do you see /tmp/zm growing?

Step 3: a) Clear /tmp/zm b) Start zmNinja, go to Menu->Montage c) Click on live view

Do you see /tmp/zm growing? (I assume yes)

mchoff avatar Dec 15 '19 22:12 mchoff

I just cannot replicate it. I switched off multi-port and tried with both 1.32 and 1.33.15

In "live view" mode (not montage), the URL zmNinja uses is like this:

For pre 1.33.x:

<img id="singlemonitor" style="width:100vw; height:100vh;" src="https://demo.zoneminder.com/cgi-bin-zm/nph-zms?mode=jpeg&amp;monitor=16&amp;scale=100&amp;auth=4b6<cut>&amp;connkey=155056&amp;rand=818387&amp;buffer=1000">

For 1.33.x:

<img class="" id="img-0" src="https://myserver/zm/cgi-bin/nph-zms?mode=jpeg&amp;monitor=1&amp;scale=50&amp;buffer=1000&amp;rand=15765106594111&amp;token=eyJ0eXAiOiJKV1Qi<cut>&amp;connkey=748163" >

Both of these use nph-zms & mode=jpeg (stream) so I can't see why its filling up /tmp/zm What does the URL look like in your zmNinja desktop, for example? (use View->Debug)

pliablepixels avatar Dec 16 '19 15:12 pliablepixels

Im going to mess around with the multi-port setup compare/contrast any clue i can find. my zm setup is on vmware so i can do snapshot prior to poking. Relatively newish install. . this is what i gather whilst growing, a different zmninja 1.3.079 on a winderz10 pc. (os doesn't seem to matter). It looks similar to yours.

<img id="singlemonitor" style="width:100vw; height:100vh;" image-spinner-loader="lines" image-spinner-src="http://192.168.33.60/zm/cgi-bin/nph-zms?mode=jpeg&amp;monitor=1&amp;scale=100&amp;buffer=1000&amp;nonauth=none&amp;rand=555167&amp;connkey=417513" ng-class="{'object-fit_cover':imageFit==false, 'object-fit_contain':imageFit==true}" on-swipe-left="onSwipe(monitorId,1)" on-swipe-right="onSwipe(monitorId,-1)" on-double-tap="closeModal();" on-tap="showHideControls();" imageonload="imageLoaded()" class="disable-user-behavior object-fit_contain" src="http://192.168.33.60/zm/cgi-bin/nph-zms?mode=jpeg&amp;monitor=1&amp;scale=100&amp;buffer=1000&amp;nonauth=none&amp;rand=555167&amp;connkey=417513">

one observation: pasting the link from debug in to the chrome browser will display stream without /tmp/zm growing.

mchoff avatar Dec 16 '19 18:12 mchoff

one observation: pasting the link from debug in to the chrome browser will display stream without /tmp/zm growing.

Hmm I wonder if its due to some angularjs variable binding. Another Q, check the value of "Stream relay buffer" in your ZM monitor settings (Buffers) - if its not 0, set to 0 and see if it makes a difference

pliablepixels avatar Dec 16 '19 19:12 pliablepixels

Hmm I wonder if its due to some angularjs variable binding. Another Q, check the value of "Stream relay buffer" in your ZM monitor settings (Buffers) - if its not 0, set to 0 and see if it makes a difference

real quick update; Stream Replay Image Buffer is set for 0 already.

mchoff avatar Dec 16 '19 23:12 mchoff

another observation: A monitor in live view will grow /tmp/zm to about 110MB-130MB (or approx 1 min 15 sec) and then stop growing larger! Streaming continues. It seem like a cache of buffer.

If i cycle to another monitor then /tmp/zm will start growing again but stops if i dont switch monitors. Going back to first monitor will start growing again. My drive fill up because i was cycling.

I'm curious and will keep digging.

mchoff avatar Dec 16 '19 23:12 mchoff

  1. I wonder if it’s to do with &buffer in the url? If so it should be replicable from the browser too.
  2. Which ZM version? I use 1.33.15 and don’t see this even with multiport off

pliablepixels avatar Dec 16 '19 23:12 pliablepixels

  1. I wonder if it’s to do with &buffer in the url? If so it should be replicable from the browser too.
  2. Which ZM version? I use 1.33.15 and don’t see this even with multiport off

Great Scott! you're right! Earlier when i put the url in the browser half got cut off, basically omitted to send buffers through.

with the FULL url in chrome browser, buffer 1000, /tmp/zm grows. Omit buffer or set to 1 then it stream in chrome without growing or does so very little, and loads a few seconds faster.

Using ZM 1.32 will probably update that soon although has been very stable (coming from 1.20 something). Since you isolate it down to buffer variable is that something that needs to or can change on my settings? It seems like it should not be growing with buffer 1000 so not sure where to look if its an issue on my settings or corrupted instance. If that's the case love to install fresh latest and see what happens!

mchoff avatar Dec 16 '19 23:12 mchoff

Please give this a try https://drive.google.com/drive/folders/1QIbVCWFctJ6GA3yziVVZDGRVwLqX0TBN?usp=sharing

You can change buffer in dev settings.

Please let me know if that fixes this issue.

pliablepixels avatar Dec 17 '19 14:12 pliablepixels

It helps decrease the amount of space to about 40MB. further down to 10 decrease space to about 4MB, proportionally. In my case on a LAN buffer of 1 seem to be smooth growing couple hundred kb per monitor cycle. It certainly prolongs the time but eventually will fill up with nothing to clean it out.

It seems that most users dont have this issue, so far two, so perhaps is isolated to our environments. I am deploying a new VM to see if I can replicate it or not and maybe how.

without any monitors playing the /tmp/zm fluctuates up and down by a few hundred kb, not sure is normal but ill see on the fresh instance. i like the buffer setting in dev though, thanks!!

mchoff avatar Dec 17 '19 20:12 mchoff

so you are saying even with buffer=1 in your install, /tmp/zm will fill up as it is never emptied? That is odd. Qs:

  • What about buffer=0 ?
  • Please also try with ZM master. If you are able to replicate this on master using just a browser and &buffer=somevalue it should be logged in ZM GitHub

pliablepixels avatar Dec 17 '19 21:12 pliablepixels

First off I'm sorry if this is a different issue but it sounds like it could be what I'm seeing. I've been running ZM/zmNinja for a year or two now and it's been working very well. I recently reorganized my desk so that I have have a monitor mounted above my normal set of monitors. I use this exclusively for running zmNinja in montage mode (sometimes clicking into a camera to see it live/bigger).

It's just dawned on me that I started to have run away ram issues with ZM shortly after adopting this setup whereas previously I never once had a ram issue. Now I have to restart the docker container 1/day or it will eat every last byte of ram and hang the server. It is regularly consuming upwards of 17GB (if it can grab it all) but it's a slow build/burn. I have 32GB of ram on this server and I just had to kill ZM and it went from full utilization (not cached but actually used) to 12GB of usage so ZM was sucking up almost 20GB.

For reference:

ZoneMinder Version: v1.32.3
zmNinja Version: v1.3.078 -- I see this is few versions behind so I'll update to the newest
Docker container: dlandon/zoneminder
Server: Unraid 6.6.7
ENV variable of note: SHMEM = 50% in my config -- not sure if that matters

Ninja edit: I should have led with this: zmNinja is amazing and I want to thank you @pliablepixels for not only creating an awesome tool but open sourcing it as well. Thank you!

joshstrange avatar Dec 19 '19 15:12 joshstrange

@joshstrange - this issue is specifically related to /tmp/zm filling up disk space (not memory) so I don't think your issue is the same. Infact, if your ZM keeps eating up memory on its own (i.e. not only when zmNinja is running) then it should probably be an issue that should be logged in ZM

Thanks for the appreciation, btw!

pliablepixels avatar Dec 19 '19 15:12 pliablepixels

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 02 '20 15:02 stale[bot]