Page 1 of 1
Bug in RFLink TCP/LAN interface
Posted: Friday 01 August 2025 18:56
by timmpo
Patform: Linux
HW: RFLink
When using RFLink with lan interface and when the connection is unstable/timeout, RFLinkTCP automatically reconnect before socket are closed in ASyncTCP and in previous version of domoticz only a error occurred in the logs (Error: ASyncTCP: connect called while socket is still open. !!!) but now in version 2025.1 the ASyncTCP.cpp has some code changes and now domoticz sometimes crashes when RFLink reconnects or when restarting HW.
My emergency solution was to add a delay between the disconnect and connect in RFLinkTCP.
But something still lurking in the ASyncTCP that will cause domoticz to crash if connections dont handles with care.
Re: Bug in RFLink TCP/LAN interface
Posted: Saturday 02 August 2025 10:13
by gizmocuz
This can be simulated by just pulling out the network cable?
Could you make a patch for this?
Re: Bug in RFLink TCP/LAN interface
Posted: Saturday 02 August 2025 11:11
by timmpo
Yes, to get the" Error: ASyncTCP: connect called while socket is still open. !!!" i think, but to get domoticz to crash i havent tested the pull plug method. This thread illustrate the problem
viewtopic.php?f=49&t=33272
This is my first 24 our without a crash in 2025.1 after i edit the RFLinkTCP.cpp. I will run some more tests and make a PR.
Now im running the wifi with low tx power setting to sumulate bad connection and no crash yet and no socket still open error.
Code: Select all
2025-08-02 05:20:00.670 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 05:22:25.694 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 05:22:50.888 Error: 433mhz Gateway 2 Entre: Can not connect to: 192.168.1.220:6666
2025-08-02 05:41:15.887 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 05:50:20.980 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 05:56:26.041 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 05:56:38.568 Error: 433mhz Gateway 2 Entre: Can not connect to: 192.168.1.220:6666
2025-08-02 05:57:09.096 Error: 433mhz Gateway 2 Entre: Can not connect to: 192.168.1.220:6666
2025-08-02 06:08:01.156 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 06:18:11.257 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 06:21:56.297 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 06:24:41.325 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 06:29:51.376 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 06:40:16.482 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 06:41:41.496 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 06:44:06.520 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 06:44:41.736 Error: 433mhz Gateway 2 Entre: Can not connect to: 192.168.1.220:6666
2025-08-02 06:49:56.578 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 06:56:01.641 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 06:57:46.658 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 07:00:11.683 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 07:14:56.834 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 07:23:41.925 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 07:27:06.961 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 07:33:12.024 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 07:36:57.062 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 07:40:42.099 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 07:44:07.132 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 07:46:12.153 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 08:27:37.585 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 08:40:42.720 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting...
2025-08-02 09:28:48.217 Error: 433mhz Gateway 2 Entre: Nothing received for more than 30 seconds, restarting..
Re: Bug in RFLink TCP/LAN interface
Posted: Saturday 02 August 2025 15:23
by gizmocuz
Thanks! Looking forward to seeing your PR!
You moved the disconnect call up?
Re: Bug in RFLink TCP/LAN interface
Posted: Sunday 03 August 2025 13:52
by timmpo
No crash yet...
I think this is to small of a thing to do a PR.
In RFLink.TCP line 92 i added a delay (5 sec.. I was quite generous):
Code: Select all
if ((m_bDoRestart) && (sec_counter % 30 == 0))
{
Log(LOG_STATUS, "Trying to connect to %s:%d", m_szIPAddress.c_str(), m_usIPPort);
disconnect();
std::this_thread::sleep_for(std::chrono::seconds(5)); // <--- Added delay here
connect(m_szIPAddress, m_usIPPort);
}