Closed dyter69 closed 9 months ago
I am trying to figure out why your Domoticz crashes due to segmentation faults. Do this happen often?
The XML parsing error happens when Domoticz, for some reason, do not receive the entire XML message sent by the camera. I am not getting this error any longer so I need more information in order to figure out what might cause it.
I assume you are using the last version of the plugin. What camera are you using? If you reboot the camera does that change anything?
I use domoticz in docker root host with synology DS918+, CPU use is about 10%, and my Cisco Poe switch about 2% of wideband for RTSP stream record (surveillance Station) Both cameras RLC-81MA & RLC-81PA have same problem, reboot doesn't change anything.
I just mod 2 lines in plugin.py:
path = os.getcwd()+"/plugins/domoticz_reolink/camera.py"
self.process = subprocess.Popen(["python", path,
to
path = "/opt/domoticz/userdata/plugins/reolink/camera.py"
self.process = subprocess.Popen(["python3", path,
same problem in pyhon1
I have news errors, this is the log in debug mode with python:
2024-01-15 02:38:29.916 Reolink Entrée: Connected successfully to: 179.60.147.13:64659
2024-01-15 02:38:29.917 Reolink Entrée: Name: '179.60.147.13:64659', Transport: 'TCP/IP', Protocol: 'XML', Address: '179.60.147.13', Port: '64659', Baud: -1, Timeout: 0, Bytes: 47, Connected: True, Last Seen: 2024-01-15 02:38:29, Parent: 'Camera webhook'
2024-01-15 02:38:29.967 Reolink Entrée: onMessage called for connection: 179.60.147.13:64659
2024-01-15 02:38:29.967 Reolink Entrée: OnMessage less than 50 bytes: b'\x03\x00\x00/*\xe0\x00\x00\x00\x00\x00Cookie: mstshash=Administr\r\n\x01\x00\x08\x00\x03\x00\x00\x00'
2024-01-15 02:38:29.967 Reolink Entrée: Response data: b'\x03\x00\x00/*\xe0\x00\x00\x00\x00\x00Cookie: mstshash=Administr\r\n\x01\x00\x08\x00\x03\x00\x00\x00'
2024-01-15 02:38:29.994 Error: Reolink Entrée: Logging error: Expecting value: line 1 column 1 (char 0)
2024-01-15 02:38:29.994 Reolink Entrée: onDisconnect called for connection '179.60.147.13:64659'.
2024-01-15 02:38:31.397 Reolink Entrée: Connected successfully to: 192.168.0.99:41360
IP 179.60.147.13 is Venezuela ! do you know why !?
I have started to do some tests and restructuring to see if I can figure out what happens in your case.
I just added a small test see if the incoming connection is either from the Webhook host (the Synology in your case) or the camera, and if it is something else an error is created. The current solution works for me but might need more testing as an example I didnt whitelist 127.0.0.1 at this point.
The ip-number you mention is unkown to me thus the added check to make sure the end-point is only called from someone approved. I also got Venezuela but also Netherland.
I have same problem :(
2024-01-16 11:45:19.486 Error: Reolink Entrée: Failed to parse message: unclosed token: line 1, column 0
2024-01-16 11:45:19.486 Error: Reolink Entrée: Failed to parse message: not well-formed (invalid token): line 1, column 5
2024-01-16 11:57:58.213 Error: Reolink Entrée: onMessage called for connection 185.217.127.16 - not in approved ip-list!
2024-01-16 16:39:31.349 Error: Reolink Jardin: Failed to parse message: syntax error: line 1, column 0
I removed internet access from the camera because I had requests even in Russia ! It therefore works locally with synology
In domoticz, I switch Basic-auth http by API to OFF, and I have add 127.0.0.;192.168.0. in trusted network
Looks like a similar problem. Plugin is working fine, only some errors. Problem is since domoticz 2024.2 update.
2024-01-16 08:32:25.105 Error: Reolink camera: Failed to parse message from camera as XML! Length: 1409 2024-01-16 08:32:25.105 Error: Reolink camera: Failed to parse message from camera as XML! Length: 3965 2024-01-16 08:59:19.169 Error: Reolink camera: Failed to parse message from camera as XML! Length: 1409 2024-01-16 08:59:19.169 Error: Reolink camera: Failed to parse message from camera as XML! Length: 3965 2024-01-16 09:13:24.264 Error: Reolink camera: Failed to parse message from camera as XML! Length: 1409 2024-01-16 09:13:24.264 Error: Reolink camera: Failed to parse message from camera as XML! Length: 3951 2024-01-16 10:07:48.945 Error: Reolink camera: Failed to parse message from camera as XML! Length: 1409 2024-01-16 10:07:48.945 Error: Reolink camera: Failed to parse message from camera as XML! Length: 3951 2024-01-16 10:16:21.922 Error: Reolink camera: Failed to parse message from camera as XML! Length: 1409 2024-01-16 10:16:21.922 Error: Reolink camera: Failed to parse message from camera as XML! Length: 3952 2024-01-16 12:08:24.271 Error: Reolink camera: Failed to parse message from camera as XML! Length: 1409 2024-01-16 12:08:24.271 Error: Reolink camera: Failed to parse message from camera as XML! Length: 3953
I have updated to last version beta of domoticz and reolink plugin, new errors appair:
2024-01-17 02:50:55.633 Error: Reolink Jardin: Failed to parse message: syntax error: line 1, column 0
2024-01-17 02:52:02.530 Error: Reolink Jardin: Failed to parse message: unclosed token: line 1, column 2834
2024-01-17 02:52:02.531 Error: Reolink Jardin: Failed to parse message: not well-formed (invalid token): line 1, column 18
2024-01-17 03:04:47.569 Error: Reolink Jardin: Failed to parse message: syntax error: line 1, column 0
2024-01-17 03:18:57.107 Error: Reolink Parking: Failed to parse message: syntax error: line 1, column 0
2024-01-17 03:20:48.778 Error: Reolink Jardin: Failed to parse message: syntax error: line 1, column 0
Dyters errors (syntax error etc) is hopefully fixed in my latest commits.
The error message for the parsing of the XML from the camera is interesting. It basically means that for some reason the message sent by the camera is not a correctly formatted XML message. I can only guess the reason for that (like the camera does not send the entire message or something else). I added a change so it writes the first and last 10 chars in the message in the Domoticz Error log.
I test the 0.0.2 and camera process failed:
2024-01-22 18:09:23.381 Error: Reolink Entree: Camera process dead: 1
2024-01-22 18:09:23.428 Error: Reolink Pergola: Camera process dead: 1
2024-01-22 18:09:23.460 Error: Reolink Parking: Camera process dead: 1
2024-01-22 18:09:23.518 Error: Reolink Jardin: Camera process dead: 1
Also did the update, only version is still the same?
2024-01-22 19:04:02.645 Status: Reolink: Started. 2024-01-22 19:04:02.645 Status: Reolink: Entering work loop. 2024-01-22 19:04:02.750 Status: Reolink: Initialized version 0.0.1, author 'jbn' 2024-01-22 19:04:17.769 Error: Reolink: Camera process dead: 1 2024-01-22 19:04:32.037 Reolink: Pushing 'onHeartbeatCallback' on to queue 2024-01-22 19:04:32.087 Reolink: Processing 'onHeartbeatCallback' message 2024-01-22 19:04:32.087 Reolink: Acquiring GIL for 'onHeartbeatCallback' 2024-01-22 19:04:32.087 Reolink: Calling message handler 'onHeartbeat' on 'module' type object. 2024-01-22 19:04:32.087 Reolink: Acquiring GIL for 'onHeartbeatCallback'
@marktn - to update you need to do:
git pull sudo python3 -m pip install -r requirements.txt --upgrade
It should look something like this:
2024-01-22 20:05:45.219 Reo: Worker thread started. 2024-01-22 20:05:45.219 Status: Reo: Entering work loop. 2024-01-22 20:05:45.220 Status: Reo: Started. 2024-01-22 20:05:46.338 Status: Reo: Initialized version 0.0.2, author 'jbn' 2024-01-22 20:05:53.925 Reo: Camera Name : Doorbell 2024-01-22 20:05:53.925 Reo: Camera Model : Reolink Video Doorbell WiFi 2024-01-22 20:05:53.925 Reo: Camera Hardware version : DB_566128M5MP_W 2024-01-22 20:05:53.925 Reo: Camera Software version : v3.0.0.2555_23080700 2024-01-22 20:05:53.925 Reo: Camera Mac_address : e2:1e:2e:1e:25:21 2024-01-22 20:05:53.925 Reo: Camera Is doorbell : True 2024-01-22 20:05:53.926 Reo: Camera AI supported : True 2024-01-22 20:05:53.926 Reo: Camera AI types : ['people'] 2024-01-22 20:13:45.269 Reo: Send On to Motion 2024-01-22 20:13:55.765 Reo: Send Off to Motion
@dyter69 The message 'Camera process dead: 1' means the camera.py have problems. The change I did this weekend was to enable camera.py to be runned in stand-alone mode. I made some small changes tonight so do a git pull again.
Does this work for you? If not, what errors do you get?
usage: camera.py [-h] [--log] [--standalone] camera_ipaddress camera_port camera_username camera_password webhook_host webhook_port
What happens if you run camera.py and give the same arguments as Domoticz does? If you change the webhook_port you can run the process in parallell to Domoticz if wanted.
python camera.py --standalone CAMERAIP 80 USERNAME PASSWORD TESTMACHINE 8992 Running in standalone mode! Terminate by pressing ctrl-c Running in standalone mode! {'Type': 'Startup', 'Name': 'Doorbell', 'Model': 'Reolink Video Doorbell WiFi', 'Hardware version': 'DB_566128M5MP_W', 'Software version': 'v3.0.0.2555_23080700', 'Mac_address': 'e2:1e:2e:1e:25:21', 'Is doorbell': 'True', 'AI supported': 'True', 'AI types': "['people']"} {'Motion': False, 'FaceDetect': False, 'PeopleDetect': False, 'VehicleDetect': False, 'DogCatDetect': False, 'MotionAlarm': False, 'Visitor': False, 'Any': False} ^CKeyboard interrupt! Terminating program, please wait! Camera logout! Program terminated
@marktn - to update you need to do:
git pull sudo python3 -m pip install -r requirements.txt --upgrade
It should look something like this:
2024-01-22 20:05:45.219 Reo: Worker thread started. 2024-01-22 20:05:45.219 Status: Reo: Entering work loop. 2024-01-22 20:05:45.220 Status: Reo: Started. 2024-01-22 20:05:46.338 Status: Reo: Initialized version 0.0.2, author 'jbn' 2024-01-22 20:05:53.925 Reo: Camera Name : Doorbell 2024-01-22 20:05:53.925 Reo: Camera Model : Reolink Video Doorbell WiFi 2024-01-22 20:05:53.925 Reo: Camera Hardware version : DB_566128M5MP_W 2024-01-22 20:05:53.925 Reo: Camera Software version : v3.0.0.2555_23080700 2024-01-22 20:05:53.925 Reo: Camera Mac_address : e2:1e:2e:1e:25:21 2024-01-22 20:05:53.925 Reo: Camera Is doorbell : True 2024-01-22 20:05:53.926 Reo: Camera AI supported : True 2024-01-22 20:05:53.926 Reo: Camera AI types : ['people'] 2024-01-22 20:13:45.269 Reo: Send On to Motion 2024-01-22 20:13:55.765 Reo: Send Off to Motion
2024-01-22 21:16:20.168 Status: Reolink: Started. 2024-01-22 21:16:20.168 Status: Reolink: Entering work loop. 2024-01-22 21:16:20.301 Status: Reolink: Initialized version 0.0.2, author 'jbn' 2024-01-22 21:16:35.320 Error: Reolink: Camera process dead: 1 2024-01-22 21:16:48.923 Error: Reolink: Camera process dead: 1
@marktn Can you also try to run camera.py in stand-alone mode and post the result?
ok I tested it:
python3 camera.py --standalone 192.168.0.96 80 admin mypassword 192.168.0.2 8096
Traceback (most recent call last):
File "/opt/domoticz/userdata/plugins/reolink/0.0.2/camera.py", line 19, in <module>
import webhook_listener
ModuleNotFoundError: No module named 'webhook_listener'
Thank you! I forgot webhook-listener is not a default module. Updated requirements.txt. Ie do the below and retry:
git pull sudo python3 -m pip install -r requirements.txt --upgrade
sorry I missed webhook-listener !
python3 camera.py --standalone 192.168.0.96 80 admin mypassword 192.168.0.2 8096
Running in standalone mode! Terminate by pressing ctrl-c
Excellent! Now it should work within Domoticz too.
Yes it seems to work ! I'll let it run overnight to see if there are still any errors
Good! Please post your findings tomorrow and hopefully evertyhing works!
I show my log this morning, and no errors on my 4 cameras reolink ! All that remains is to simplify and optimize the plugin!
Excellent, good news! Regarding your comment om simplify and optimize. Do you have anything special in mind? Thus far I have focused on stability and functionality.
What about you @marktn?
everything in one file plugin.py with no pip install would be perfect !
Thank for your plugin, I can now cut the cameras access from internet !
Thank you, everything in one file depends on what you mean. But I can think about implementing a feature that handles more than one camera at the same time (feature request created).
I have many errors log of this type:
With end stop of domoticz: 2024-01-07 09:28:51.735 Error: Domoticz(pid:1, tid:32('Reolink Jardin')) received fatal signal 11 (Segmentation fault) 2024-01-07 09:28:51.735 Error: siginfo address=0x1, address=0x7fd168b43fe1 2024-01-07 09:28:51.767 Error: Failed to start gdb, will use backtrace() for printing stack frame
I use 2x plugins for 2x camera with 2 differents webhook port