Bug in RFLink TCP/LAN interface

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
timmpo
Posts: 20
Joined: Sunday 24 February 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Bug in RFLink TCP/LAN interface

Post 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.
User avatar
gizmocuz
Posts: 2561
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Bug in RFLink TCP/LAN interface

Post by gizmocuz »

This can be simulated by just pulling out the network cable?
Could you make a patch for this?
Quality outlives Quantity!
timmpo
Posts: 20
Joined: Sunday 24 February 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Bug in RFLink TCP/LAN interface

Post 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..
User avatar
gizmocuz
Posts: 2561
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Bug in RFLink TCP/LAN interface

Post by gizmocuz »

Thanks! Looking forward to seeing your PR!
You moved the disconnect call up?
Quality outlives Quantity!
timmpo
Posts: 20
Joined: Sunday 24 February 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Bug in RFLink TCP/LAN interface

Post 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);
		}
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest