danielfernau / unifi-protect-video-downloader

Tool for downloading footage from a local UniFi Protect system
https://ui-protect-dl-docs.danielfernau.com/
MIT License
468 stars 52 forks source link

Non-monotonic timestamp provided. #35

Open superforno opened 3 years ago

superforno commented 3 years ago

Using v 2.x I've got the following result on some files, downloading with events command:

docker run --network=unifi-udm-api-proxy_default --volume C:/Users/super/UnifiProtect/downloads:/downloads unifitoolbox/protect-archiver events --address="unifi-udm-api-proxy" --username="***" --password="***" --start="2020-07-19 00:00:00" --end="2020-07-21 23:59:59" /downloads

Setup is UDMPro proxyed as described in project readme.

I've downloaded an entire month of events but day 20th fails some files, with this message: Downloading motion event 905e at 2020-07-20 22:01:43.822000 for camera 'Soggiorno' (5f01b48e02274b03870003ee) to /downloads/2020/07/20/Soggiorno (03ee)/Soggiorno (03ee) - 2020-07-20 - 22.01.43.mp4 Download failed with status 500 Internal Server Error Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/protect_archiver/client.py", line 181, in download_file raise cls( protect_archiver.client.DownloadFailed: Download failed with status 500 Internal Server Error: Non-monotonic timestamp provided Retrying in 3 second(s)... Download failed with status 500 Internal Server Error Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/protect_archiver/client.py", line 181, in download_file raise cls( protect_archiver.client.DownloadFailed: Download failed with status 500 Internal Server Error: Non-monotonic timestamp provided Retrying in 3 second(s)... Download failed with status 500 Internal Server Error Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/protect_archiver/client.py", line 181, in download_file raise cls( protect_archiver.client.DownloadFailed: Download failed with status 500 Internal Server Error: Non-monotonic timestamp provided Retrying in 3 second(s)...

Any ideas?

danielfernau commented 3 years ago

Hi @superforno

Thanks for opening this issue. The error you encountered occurs from time to time – but I wasn't yet able to figure out why. It might be caused by an issue with the way the time segments are being calculated, or maybe it's an error on the server side.

Right now I'm primarily working on issues around authentication between the tool and the Protect server. However, I'll come back to this issue as soon as possible and see what I can do.

superforno commented 3 years ago

Hi @superforno

Thanks for opening this issue. The error you encountered occurs from time to time – but I wasn't yet able to figure out why. It might be caused by an issue with the way the time segments are being calculated, or maybe it's an error on the server side.

Right now I'm primarily working on issues around authentication between the tool and the Protect server. However, I'll come back to this issue as soon as possible and see what I can do.

Ok, meanwhile I've experienced another error, I'll try again and see, maybe I'll open a different issue.

danielfernau commented 3 years ago

Hi @superforno

A new release – v2.0.1 – is now available. Please have a look if the problem you've reported here still occurs.

superforno commented 3 years ago

Hi @superforno

A new release – v2.0.1 – is now available. Please have a look if the problem you've reported here still occurs.

Thanks, I need some time to check, busy days, but I will let you know as soon as possible!

danielfernau commented 3 years ago

Sure, no worries. It took me way too long before I got around to providing a fix for these issues in the first place – so take your time 😄

michaelyork commented 2 years ago

Unfortunately I still consistently run into this issue. Anything I can do to help debug?

danielfernau commented 2 years ago

Still happening to me as well from time to time. The 5xx errors are not easy to figure out, even with access to the UDM log files. Not sure if it's one of the requests by the downloader causing the Protect server to throw an error, or if it's an internal error. However, since I've also encountered similar errors while trying to download recordings directly via a web browser I'd assume it's something within the API/App itself.

Thanks for offering your help. If you want (and have the time) to dig through the various Protect log files on your system, feel free to do so. They're located in /srv/unifi-protect/logs/*. I'll do the same on my system. Maybe we can at least narrow it down a bit...