Supergiovane / node-red-contrib-hikvision-ultimate

A native set of node for Hikvision Cameras, Doorbells, Alarms, Radars etc.
https://www.facebook.com/supergiovaneDev
MIT License
51 stars 11 forks source link

Crashes when DVR/NVR loses IP or powers down #6

Closed aagiannidis closed 3 years ago

aagiannidis commented 3 years ago

Hi all,

with node picture fetching an image from the DVR every 5 seconds and when the DVR is removed from the network or is powered down, Google Chrome freezes and node-red throws the following messages. Powering up the device and when it gets its ipaddress all is restored to normal.

(node:8712) UnhandledPromiseRejectionWarning: FetchError: network timeout at: ht tp://192.168.1.130/ISAPI/Streaming/channels/101/picture at Timeout. (C:\Users\Thanos.node-red\node_modules\node-fetch\li b\index.js:1454:13) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7) (node:8712) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To termina te the node process on unhandled promise rejection, use the CLI flag --unhandle d-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejectio ns_mode). (rejection id: 878) (node:8712) UnhandledPromiseRejectionWarning: AbortError: The user aborted a req uest. at abort (C:\Users\Thanos.node-red\node_modules\node-fetch\lib\index.js:141 8:16) at AbortSignal.abortAndFinalize (C:\Users\Thanos.node-red\node_modules\node -fetch\lib\index.js:1433:4) at AbortSignal.dispatchEvent (C:\Users\Thanos.node-red\node_modules\event-t arget-shim\dist\event-target-shim.js:818:35) at abortSignal (C:\Users\Thanos.node-red\node_modules\abort-controller\dist \abort-controller.js:52:12) at AbortController.abort (C:\Users\Thanos.node-red\node_modules\abort-contr oller\dist\abort-controller.js:91:9) at Hikvisionconfig.node.request (C:\Users\Thanos.node-red\node_modules\node -red-contrib-hikvision-ultimate\nodes\Hikvision-config.js:337:63) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:8712) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To termina te the node process on unhandled promise rejection, use the CLI flag --unhandle d-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejectio ns_mode). (rejection id: 879)

Supergiovane commented 3 years ago

Hello please be aware, that fetching an image every 5 seconds requires a lot of CPU power. What version of node-red and node.js are you using?

aagiannidis commented 3 years ago

Hi and thanks for your reply...I am aware of the cpu power that it consumes. I was giving it a test run to see how it goes...

Here is my system info on Windows 7.

25 Jan 22:01:02 - [info] Node-RED version: v1.2.6 25 Jan 22:01:02 - [info] Node.js version: v12.20.0 25 Jan 22:01:02 - [info] Windows_NT 6.1.7601 x64 LE 25 Jan 22:01:04 - [info] Loading palette nodes 25 Jan 22:01:06 - [info] Dashboard up and running

On Mon, 25 Jan 2021 at 21:05, Supergiovane notifications@github.com wrote:

Hello please be aware, that fetching an image every 5 seconds requires a lot of CPU power. What version of node-red and node.js are you using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Supergiovane/node-red-contrib-hikvision-ultimate/issues/6#issuecomment-767042943, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALOU4YT6PZXBI3RH7CGZ6JTS3W6GHANCNFSM4WSFTJ4A .

Supergiovane commented 3 years ago

Hi this is an warning sent by the fetch module. Tomorrow i'll take a look to prevent unwanted logging. As for the freeze, in the meantume, you should check the output from the node (before sending it to the image node), wether the payload is empty.

aagiannidis commented 3 years ago

Hi, it is not the logging that causes an issue...it is the fact that node-red admin panel in chrome freezed...

The status of the image node said Horror !if that helps.It was not the speed of the image update that caused the freeze...I had it working for hours...

Anyway, you do your magic and i will test it again.

On Mon, 25 Jan 2021 at 22:56, Supergiovane notifications@github.com wrote:

Hi this is an warning sent by the fetch module. Tomorrow i'll take a look to prevent unwanted logging. As for the freeze, in the meantume, you should check the output from the node (before sending it to the image node), wether the payload is empty.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Supergiovane/node-red-contrib-hikvision-ultimate/issues/6#issuecomment-767106887, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALOU4YUWH7KO3ILTXUIINNLS3XLGLANCNFSM4WSFTJ4A .

Supergiovane commented 3 years ago

Hi aagiannidis i can reproduce the unwanted log, but my admin panel still responds as usual. Can you please paste here your flow's chain? (at least, the part involved in the issue). Thanks.

aagiannidis commented 3 years ago

Good morning and thank you for looking into this.

Here is my flow...

[{"id":"43a6f351.8fc85c","type":"hikvisionUltimateAlarm","z":"44d1350e.3dde0c","name":"","topic":"","server":"2bebf108.22ca6e","reactto":"vmd","x":180,"y":140,"wires":[["afe832a0.b97d8"],["b14a0902.e0c428"]]},{"id":"afe832a0.b97d8","type":"debug","z":"44d1350e.3dde0c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":470,"y":80,"wires":[]},{"id":"b14a0902.e0c428","type":"debug","z":"44d1350e.3dde0c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":490,"y":120,"wires":[]},{"id":"732dea2d.c40b84","type":"hikvisionUltimateAlarmRaw","z":"44d1350e.3dde0c","name":"","topic":"","server":"2bebf108.22ca6e","x":180,"y":240,"wires":[["62104b08.dab154"],["a135f028.811ba"]]},{"id":"a135f028.811ba","type":"debug","z":"44d1350e.3dde0c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":370,"y":280,"wires":[]},{"id":"62104b08.dab154","type":"debug","z":"44d1350e.3dde0c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":390,"y":240,"wires":[]},{"id":"68746555.c5ccfc","type":"template","z":"44d1350e.3dde0c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<img width=\"300px\" height=\"230px\" src=\"{{{payload}}}\">","output":"str","x":420,"y":360,"wires":[["fdd50b23.83cfa8"]]},{"id":"fdd50b23.83cfa8","type":"ui_template","z":"44d1350e.3dde0c","group":"c1bf19aa.fe7fb8","name":"","order":0,"width":"6","height":"5","format":"<div width=\"360px\" height=\"260px\" ng-bind-html=\"msg.payload\">

","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":640,"y":360,"wires":[[]]},{"id":"2af83621.9f226a","type":"hikvisionUltimatePicture","z":"44d1350e.3dde0c","name":"","topic":"","server":"2bebf108.22ca6e","channelID":"1","rotateimage":"0","heightimage":"","widthimage":"","qualityimage":"100","cropimage":"","x":220,"y":360,"wires":[["68746555.c5ccfc"],["1e92702e.0ee3b"]]},{"id":"1e92702e.0ee3b","type":"debug","z":"44d1350e.3dde0c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":430,"y":400,"wires":[]},{"id":"6456ffd.cdcb4","type":"inject","z":"44d1350e.3dde0c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"5","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":90,"y":360,"wires":[["2af83621.9f226a"]]},{"id":"944498f.d4bb768","type":"status","z":"44d1350e.3dde0c","name":"","scope":["43a6f351.8fc85c"],"x":260,"y":200,"wires":[["ece74233.637be"]]},{"id":"ece74233.637be","type":"debug","z":"44d1350e.3dde0c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"status","targetType":"msg","statusVal":"","statusType":"auto","x":490,"y":200,"wires":[]},{"id":"2bebf108.22ca6e","type":"Hikvision-config","host":"192.168.1.130","port":"80","name":"Embedded Net DVR","authentication":"digest","protocol":"http","heartbeattimerdisconnectionlimit":"4","deviceinfo":"{\"DeviceInfo\":{\"$\":{\"version\":\"1.0\",\"xmlns\":\" http://www.hikvision.com/ver20/XMLSchema\"},\"deviceName\":\"Embedded Net DVR\",\"deviceID\":\"48363633-3330-3333-3735-a4143797d472\",\"model\":\"DS-7204HQHI-F1/N\",\"serialNumber\":\"DS-7204HQHI-F1/N0420161019CCWR663303375WCVU\",\"macAddress\":\"a4:14:37:97:d4:72\",\"firmwareVersion\":\"V3.4.81\",\"firmwareReleasedDate\":\"build 170227\",\"encoderVersion\":\"V5.0\",\"encoderReleasedDate\":\"build 170220\",\"deviceType\":\"IPC\",\"telecontrolID\":\"255\"}}"},{"id":"c1bf19aa.fe7fb8","type":"ui_group","name":"Frame Grab","tab":"e0f42233.22428","order":1,"disp":true,"width":"7","collapse":false},{"id":"e0f42233.22428","type":"ui_tab","name":"NVR","icon":"dashboard","order":13}]

On Tue, 26 Jan 2021 at 09:05, Supergiovane notifications@github.com wrote:

Hi aagiannidis i can reproduce the unwanted log, but my admin panel still responds as usual. Can you please paste here your flow's chain? (at least, the part involved in the issue). Thanks.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Supergiovane/node-red-contrib-hikvision-ultimate/issues/6#issuecomment-767348175, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALOU4YQVI6B7FU3MTM7U67DS3ZSUNANCNFSM4WSFTJ4A .

Supergiovane commented 3 years ago

Hi aagiannidis there are unterminating string errors. Please send it VIA GITHUB BETWEEN CODE TAGS Thanks.

aagiannidis commented 3 years ago

[{"id":"43a6f351.8fc85c","type":"hikvisionUltimateAlarm","z":"44d1350e.3dde0c","name":"","topic":"","server":"2bebf108.22ca6e","reactto":"vmd","x":180,"y":140,"wires":[["afe832a0.b97d8","64b836ed.2c10d8"],["b14a0902.e0c428"]]},{"id":"afe832a0.b97d8","type":"debug","z":"44d1350e.3dde0c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":310,"y":80,"wires":[]},{"id":"b14a0902.e0c428","type":"debug","z":"44d1350e.3dde0c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":370,"y":120,"wires":[]},{"id":"732dea2d.c40b84","type":"hikvisionUltimateAlarmRaw","z":"44d1350e.3dde0c","name":"","topic":"","server":"2bebf108.22ca6e","x":180,"y":240,"wires":[["62104b08.dab154"],["a135f028.811ba"]]},{"id":"a135f028.811ba","type":"debug","z":"44d1350e.3dde0c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":370,"y":280,"wires":[]},{"id":"62104b08.dab154","type":"debug","z":"44d1350e.3dde0c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":390,"y":240,"wires":[]},{"id":"68746555.c5ccfc","type":"template","z":"44d1350e.3dde0c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<img width=\"300px\" height=\"230px\" src=\"{{{payload}}}\">","output":"str","x":420,"y":360,"wires":[["fdd50b23.83cfa8"]]},{"id":"2af83621.9f226a","type":"hikvisionUltimatePicture","z":"44d1350e.3dde0c","name":"","topic":"","server":"2bebf108.22ca6e","channelID":"1","rotateimage":"0","heightimage":"","widthimage":"","qualityimage":"100","cropimage":"","x":220,"y":360,"wires":[["68746555.c5ccfc"],["1e92702e.0ee3b"]]},{"id":"1e92702e.0ee3b","type":"debug","z":"44d1350e.3dde0c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":430,"y":400,"wires":[]},{"id":"6456ffd.cdcb4","type":"inject","z":"44d1350e.3dde0c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":90,"y":360,"wires":[["2af83621.9f226a"]]},{"id":"944498f.d4bb768","type":"status","z":"44d1350e.3dde0c","name":"","scope":["43a6f351.8fc85c"],"x":260,"y":200,"wires":[["ece74233.637be"]]},{"id":"ece74233.637be","type":"debug","z":"44d1350e.3dde0c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"status","targetType":"msg","statusVal":"","statusType":"auto","x":490,"y":200,"wires":[]},{"id":"fdd50b23.83cfa8","type":"ui_template","z":"44d1350e.3dde0c","group":"c1bf19aa.fe7fb8","name":"","order":0,"width":"6","height":"5","format":"<div width=\"360px\" height=\"260px\" ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":640,"y":360,"wires":[[]]},{"id":"2bebf108.22ca6e","type":"Hikvision-config","host":"192.168.1.130","port":"80","name":"Embedded Net DVR","authentication":"digest","protocol":"http","heartbeattimerdisconnectionlimit":"4","deviceinfo":"{\"DeviceInfo\":{\"$\":{\"version\":\"1.0\",\"xmlns\":\"http://www.hikvision.com/ver20/XMLSchema\"},\"deviceName\":\"Embedded Net DVR\",\"deviceID\":\"48363633-3330-3333-3735-a4143797d472\",\"model\":\"DS-7204HQHI-F1/N\",\"serialNumber\":\"DS-7204HQHI-F1/N0420161019CCWR663303375WCVU\",\"macAddress\":\"a4:14:37:97:d4:72\",\"firmwareVersion\":\"V3.4.81\",\"firmwareReleasedDate\":\"build 170227\",\"encoderVersion\":\"V5.0\",\"encoderReleasedDate\":\"build 170220\",\"deviceType\":\"IPC\",\"telecontrolID\":\"255\"}}"},{"id":"c1bf19aa.fe7fb8","type":"ui_group","name":"Frame Grab","tab":"e0f42233.22428","order":1,"disp":true,"width":"7","collapse":false},{"id":"e0f42233.22428","type":"ui_tab","name":"NVR","icon":"dashboard","order":13}]

Supergiovane commented 3 years ago

Hi i cannot reproduce the freeze. Tested with Chrome. Please see the video. The admin UI remains responsive even with disconnecting the NVR.

https://user-images.githubusercontent.com/37666636/105858719-ed698180-5feb-11eb-9187-618aa5400a7a.mov

aagiannidis commented 3 years ago

Hi and thanks for giving it a go...I repeated the experiment by disconnecting the dvr from the network and all seems ok.

I guess it was a difficult to reproduce glitch? Anyway all seems ok. Thank you for your all prompt replies and congratulations on doing a great job with the plugin...!!!

On Tue, 26 Jan 2021 at 16:35, Supergiovane notifications@github.com wrote:

Hi i cannot reproduce the freeze. Tested with Chrome. Please see the video. The admin UI remains responsive even without disconnecting the NVR.

https://user-images.githubusercontent.com/37666636/105858719-ed698180-5feb-11eb-9187-618aa5400a7a.mov

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Supergiovane/node-red-contrib-hikvision-ultimate/issues/6#issuecomment-767581649, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALOU4YTDGPPIBHWTNOLAXDDS33HJZANCNFSM4WSFTJ4A .