ispysoftware / iSpy

Open source surveillance software
http://www.ispyconnect.com
Other
1.35k stars 534 forks source link

Cpu load when no active cameras #85

Open john-arvid opened 5 years ago

john-arvid commented 5 years ago

Hi,

I have am using one camera in my setup. This camera is only alive once in a while. When the camera is offline I still see >15% cpu usage. What is actually iSpy doing in the background? This also occur when I have turned off the camera in iSpy.

Using version 7.2.1.0

ispysoftware commented 5 years ago

Ispy reports the total CPU of your system. If it's ispy using it then it could be running storage management. If you want to see exactly what it's doing then download the source code and attach a debugger.

john-arvid commented 5 years ago

Ok, let me rephrase: Is this expected behaviour?

A clean install has ~0% cpu utilization 1 active camera has ~23% cpu utilization 1 inactive (offline) camera has ~19% cpu utilization Removing the camera still causes ~19% cpu utilization iSpy does not utilize any disk io (just once in a while when the camera is active)

ispysoftware commented 5 years ago

no idea, possibly a device driver issue where disabling the camera isn't actually stopping the camera from capturing. Try starting ispy without the camera enabled. Definitely nothing in our code should be causing 19% cpu unless you have an enormous media folder.

john-arvid commented 5 years ago

Have done what you suggested and the cpu utilization is now ~0% I will wait a day and see if this occurs again.

john-arvid commented 5 years ago

It looks like iSpy needs to be restarted once in a while for the cpu utilization to go down. The utilization is going more and more up as more time passes. (Not much, until now it came up to 10%)

I also noticed that disabling the camera didn't stop the network stream, the image went blank, but network utilization was still there. This problem was also solved by restarting iSpy.

I am using a RTSP camera.

ispysoftware commented 5 years ago

Are you able to port forward the camera so I can test from my side? Pretty weird.. haven't had reports of this happening before

john-arvid commented 5 years ago

Not that camera, but I can set up another one. Let me know if you want that. I think the only reason that I see it is because I have one camera that goes on and off many times and I like to keep track of my cpu resources.

reece8765 commented 5 years ago

Hey John. I'm not an iSpy developer or representitive. I will however be testing this on the latest release (7.2.1.0) - in case you're not up to date, update first. Either way, I'm about to begin testing to see if I can replicate your issue to back you up here :P

john-arvid commented 5 years ago

Hey Reece. Thank you for testing! Yes I am using the latest release. More information about my setup: My camera is a rtsp camera that is built of a camera module connected to a raspberry pi. This raspberry looses power now and then.

reece8765 commented 5 years ago

Hey John, Thanks for confirming you're on the latest release, I did see that after I posted my comment haha. Okay, after 5 hours of testing, recording, removing files, adding and removing cameras and switching them on and off at random intervals, here's what I found: Upon activating a camera (during callibration): CPU usage up to 23% Viewing camera (after callibration): CPU Usage down to 20% Recording and viewing: CPU Usage up to 38% Recording in background: CPU Usage down to around 4 - 6% Deactivating a camera during recording: Stayed around 1% for a while, dropped to 0% Unplugging a camera during recording: Somehow a secondary corrupt file appeared, original recording up to the time of camera disconnection seems fine (bug found), CPU Usage around 3 - 4% for a few seconds, dropped to 0%.

My machine compared to a Respberry Pi is substantial, specs: 2x1TB drives for data storage, 1 drive in use for iSpy 1x126GB SSD for OS and applications OS: Windows Server 2016 Processor: AMD Quad Core 3.5 GHz RAM: DDR3 12GB Motherboard: ASRock Camera: Unknown make/model, 1080P

Hope this supports at least something in your report here and raises awareness that there is a bug when the camera is unexpectedly unplugged. Other than that, I'll leave you with the experts. Sorry I wasn't much more of a use here!

phuein commented 5 years ago

I have the same issue. After recording, with recording disabled and iSpy still running - camera inactive (I have a light that shows when it's active,) iSpy is still using about 30% CPU (task manager Win 10.)

Looks like a bug with iSpy. Latest drivers on a Logitech C920. Win 10 updated. No disk usage.

Restarting iSpy with devices disabled restores it to about 1% CPU usage. Then activating the camera and letting it calibrate, and then disabling, works fine. Looks to be related to recording. I didn't notice this issue with previous versions, but I don't recall checking for a while.

ispysoftware commented 5 years ago

Are you able to build it from source and check what threads are running?

phuein commented 4 years ago

Any updates on this? It's becoming a real problem. Sometimes it takes 50% of my CPU, making any other activity lag. That's without any recording going on, as explained above.

ispysoftware commented 4 years ago

im not able to reproduce it - i need someone that is having the problem to build it from source and reproduce the issue and check which threads aren't being closed.

phuein commented 4 years ago

You don't have a reporting tool in the program to let users send you technical details? Can't expect the average user to build it from source because of a bug.

ispysoftware commented 4 years ago

It's an open source project. Have you checked the log files? View - log file

phuein commented 4 years ago

EDIT: If it helps to reproduce, I start the program from the win10 Task Scheduler with: "C:\Program Files\iSpy\iSpy.exe" commands "bringonline,2,1|recordondetecton,2,1" And end the recording with: "C:\Program Files\iSpy\iSpy.exe" commands "recordingoff,2,1|takeoffline,2,1"

It's just a lot of this:

Message 12:41:22 PM using software encoder
Message 12:41:22 PM recordingstarted: C615 message: 192.168.1.77loadclip.mp4%3Foid%3D1%26ot%3D2%26fn%3D1_2019-10-26_12-41-22.mp4%26auth%3Dd9157f8a-5a87-4d54-bfb0-cd1219e9da2b
Message 12:41:37 PM recordingstopped: C615 message: 192.168.1.77loadclip.mp4%3Foid%3D1%26ot%3D2%26fn%3D1_2019-10-26_12-41-22.mp4%26auth%3Dd9157f8a-5a87-4d54-bfb0-cd1219e9da2b
Message 12:49:06 PM using software encoder
Message 12:49:06 PM recordingstarted: C615 message: 192.168.1.77loadclip.mp4%3Foid%3D1%26ot%3D2%26fn%3D1_2019-10-26_12-49-06.mp4%26auth%3Dd9157f8a-5a87-4d54-bfb0-cd1219e9da2b
Message 12:49:24 PM recordingstopped: C615 message: 192.168.1.77loadclip.mp4%3Foid%3D1%26ot%3D2%26fn%3D1_2019-10-26_12-49-06.mp4%26auth%3Dd9157f8a-5a87-4d54-bfb0-cd1219e9da2b
Message 12:49:35 PM using software encoder
Message 12:49:35 PM recordingstarted: C615 message: 192.168.1.77loadclip.mp4%3Foid%3D1%26ot%3D2%26fn%3D1_2019-10-26_12-49-35.mp4%26auth%3Dd9157f8a-5a87-4d54-bfb0-cd1219e9da2b
Message 12:49:53 PM Running Command: recordingoff,2,1
Message 12:49:53 PM Running Command: takeoffline,2,1
Message 12:49:53 PM recordingstopped: C615 message: 192.168.1.77loadclip.mp4%3Foid%3D1%26ot%3D2%26fn%3D1_2019-10-26_12-49-35.mp4%26auth%3Dd9157f8a-5a87-4d54-bfb0-cd1219e9da2b
Message 3:13:25 PM Network Change
Message 3:13:30 PM Network Change
ShaneZampire commented 4 years ago

Did anyone ever find a solution to this? I had to cut the CPU usage in settings down to 60% because its was using the full 90% even with all cameras disabled. This problem just started when I upgraded from a 6.? version to the newest. https://i.imgur.com/VyLMxkK.png

john-arvid commented 4 years ago

It looks like there is a bug handling the closing of the old/severed VLC connection. But I don't have the time to confirm this. My solution was to use another application called Shinobi. (Linux only, but you can run it in docker on windows)

But one dirty hack would be to add a scheduler task that stops and starts iSpy every day. (Or some other schedule that might fit you better)

ispysoftware commented 4 years ago

there's a re-write of the VLC code on the latest github source code. I'll be packaging it up into a new release in the next week or so