[BUG] Remote harvesters fail to connect when main farmer's IP address changes
See original GitHub issueDescribe the bug When using remote harvesters, if the farmer is set to a hostname instead of an IP address in the configuration file, then they will repeatedly fail to reconnect if the farmer changes IP address:
23:04:43.790 harvester harvester : INFO Reconnecting to peer {'host': '(OLD IP ADDRESS)', 'port': 8447}
To reproduce
- Set up a main farming machine and one or more remote harvesters
- In the configuration file, set
farmer_peer
->host
to the hostname of the farmer - Change the IP address of the farmer
- Check the error log of the harvester
Expected behavior The remote harvester should not cache the IP address. DNS lookups should be performed on non-caching authoritative servers, either in the first instance or once the remote harvester has failed to connect X number of times.
In the remote harvester wiki page, it does mention to use an IP address. But a hostname should also be acceptable. Firstly, because the configuration parameter is named as host
and by default is set to localhost
. Secondly, it will be more convenient for many people using DDNS services.
In addition, this error is repeatedly raised every ~14 seconds but is only logged at INFO
level. Since it prevents farming, it should be raised at a higher level, either on the first failed connection, or after X number of repeated failed connections.
Environment
- OS: Linux
- OS Version/Flavor: Ubuntu Server 20.04.2
Additional context The problem may also occur with other hostname configuration fields, such as connecting to a remote note or connecting to a remote daemon in “UI only mode”. But I have not tested this and only encountered the issue with remote harvesters.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top GitHub Comments
I think this is because the hostname is only resolved once and from then on, only the IP is used. A possible fix could be to add this one line
to chia/server/reconnect_task.py
This would hopefully re-translate the hostname whenever a reconnection is attempted.
The problem still exist in the 1.2.3