kbr/fritzconnection

Timeout after 30 Min

tichachm opened this issue · 3 comments

Hi I am using the homeassistant integration for FritzBox Call Monitor, I think it is using this lib to connect to FritzBox.

I can also reproduce this issue calling fritzmonitor like described here: https://fritzconnection.readthedocs.io/en/1.9.1/sources/call_monitoring.html

It is working fine but after about 30 minutes it does not react on any call.

It looks like the problem is in fritzconnection.core.fritzmonitor

If I add following lines in '_get_connected_socket' after 'sock.settimeout(self.timeout)' the problem seems to be fixed:

sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 10)
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 100)
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 5)

see: home-assistant/core#61880

kbr commented

There was an extensive discussion about this in another thread #76 – waiting to get reopen in case of more knowledge about the socket options. Problem has been, that the options are partly OS dependent and the documentation, if any, was not very helpful. What I absolutely want to avoid is programming by guessing.

Thanks for the fast answer and link to the other discussion.
I think my issue is network-related. Here some more information about the setup:
HomeAssistant is running in a docker container in host mode on a Linux VM.
But I also get this issue with the host system and on Windows, everywhere after about 30 minutes.

Between FritzBox and my Server/PC there is a additional Router (Lancom) i think this one is causing this problem.
There are some routing/firewall settings for TCP-Aging but until now I could not figure out what to change.

kbr commented

I like to close this – again with referring to #76. Keep this as "hibernated" work in progress, and wake up on getting proper documentation.