FalkTannhaeuser / python-onvif-zeep

ONVIF Client Implementation in Python 2+3 (using https://github.com/mvantellingen/python-zeep instead of suds as SOAP client)
MIT License
433 stars 144 forks source link

multiprocessing: ONVIFCamera.__init__() does not succeed when run from another core #60

Open Guilmort opened 4 years ago

Guilmort commented 4 years ago

From a process launched through the Python 3.8 multiprocessing module when trying to call init from an ONVIFCamera instance my code get stuck.

Within update_xaddrs() method call on the following line :

capabilities = self.devicemgmt.GetCapabilities({'Category': 'All'})

It never returns and get stuck.

jasonbrown-helios commented 4 years ago

Hi Guys I also have an issue where the code stops at the above line, though we don't use multiprocessing we are using threading. I have this issue intermittently with one camera in particular and a reboot of the camera will fix the issue. Eventually though the issue comes back, I am trying to flag an error rather than just never get a reply from update_xaddrs().

jasonbrown-helios commented 4 years ago

@Guilmort I managed to get around this issue by doing the following. from zeep.transports import Transport

Then when calling cam = ONVIFCamera add transport=Transport(operation_timeout=xx) so for example cam = ONVIFCamera(ip_address, port, username, password, transport=Transport(operation_timeout=30))

To me it looks like Zeep is not timing out, it is supposed to have a default timeout of 300, but I found other posts complaining that Zeep was ignoring its default timeout, so operation_timeout was added.