#1213·resty

Bug: LoadBalancerFeedback on connection io timeout

Author: sergelogvinovCreated Sep 7, 2026Updated Sep 8, 2026

Hello, thank you for the project.

I’m trying to use the Load Balancer and found an interesting issue.

When a host is unreachable or the port returns a tcp reset (when the host is no longer listed), the Load Balancer doesn’t seem to receive any feedback about it. As a result, the next request may try to use the same host again. After a few attempts (retryCount greater than 1), it eventually reaches another healthy host.

What do you think about calling the feedback function when a network/tcp error occurs, so the Load Balancer can immediately mark that host as unhealthy?

add lines after 1520 line:

go
			if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
				r.sendLoadBalancerFeedback(nil, err)
			}

https://github.com/go-resty/resty/blob/51f294a71849c21c3c4406b45de655a2c68588e0/request.go#L1515-L1530

and fix line

go
success = !(errors.Is(noe.Err, syscall.ECONNREFUSED) || noe.Timeout())

https://github.com/go-resty/resty/blob/51f294a71849c21c3c4406b45de655a2c68588e0/request.go#L1866-L1871

Thanks.