golang model: 1.22.2
Construct system: AlmaLinux launch 9.3
When dialContext passes within the handle is a website identify. For a number of ips of area identify decision, I block the community of 1 ip by iptables drop technique to simulate community failure.
Examine the documentation. Understanding that dialcontext is passing in a number of ips for the area identify, it would divide the timeout set to every ip equally.
The dialcontext instance I examined was handed the handle www.baidu.com:443 and the timeout was 2 seconds. www.baidu.com resolves to 2 ips on my community. In principle, the timeout for every ip connection could be 1 second.
However in my repeated checks, I discovered three completely different outcomes. The community is quick (perhaps the primary connection ip is just not blocked by iptables) and the community is delayed (perhaps the primary connection is the ip blocked by iptables. The try to connect with the second regular ip succeeded). The primary two are inside my expectations. The third result’s that the dialcontext returns a timeout. The outcome exceeded expectations.
The likelihood of the third construction may be very excessive. This drawback endured even after the retry mechanism was added.
I traced the community calls with strace. join calls port 9 as a substitute of 443. I don’t know why.
Within the third case, I catch the 443 packet with tcpdump and don’t see the tcp syn handshake packet despatched by the system.
join(8, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("223.5.5.5")}, 16) = 0 <0.000027>
getsockname(8, {sa_family=AF_INET, sin_port=htons(60874), sin_addr=inet_addr("172.20.0.13")}, [112 => 16]) = 0 <0.000036>
getpeername(8, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("223.5.5.5")}, [112 => 16]) = 0 <0.000011>
socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 8 <0.000027>
setsockopt(8, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0 <0.000032>
join(8, {sa_family=AF_INET, sin_port=htons(9), sin_addr=inet_addr("183.2.172.42")}, 16) = 0 <0.000021>
getsockname(8, {sa_family=AF_INET, sin_port=htons(46937), sin_addr=inet_addr("172.20.0.13")}, [112 => 16]) = 0 <0.000016>
getpeername(8, {sa_family=AF_INET, sin_port=htons(9), sin_addr=inet_addr("183.2.172.42")}, [112 => 16]) = 0 <0.000016>
socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 8 <0.000017>
setsockopt(8, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0 <0.000013>
join(8, {sa_family=AF_INET, sin_port=htons(9), sin_addr=inet_addr("183.2.172.185")}, 16) = 0 <0.000013>
getsockname(8, {sa_family=AF_INET, sin_port=htons(60023), sin_addr=inet_addr("172.20.0.13")}, [112 => 16]) = 0 <0.000026>
getpeername(8, {sa_family=AF_INET, sin_port=htons(9), sin_addr=inet_addr("183.2.172.185")}, [112 => 16]) = 0 <0.000013>
socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 8 <0.000031>
join(8, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("183.2.172.42")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000043>
socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 8 <0.000044>
setsockopt(8, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0 <0.000062>
join(8, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("223.5.5.5")}, 16) = 0 <0.000027>
getsockname(8, {sa_family=AF_INET, sin_port=htons(56527), sin_addr=inet_addr("172.20.0.13")}, [112 => 16]) = 0 <0.000011>
getpeername(8, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("223.5.5.5")}, [112 => 16]) = 0 <0.000008>
socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 8 <0.000054>
setsockopt(8, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0 <0.000049>
join(8, {sa_family=AF_INET, sin_port=htons(9), sin_addr=inet_addr("183.2.172.42")}, 16) = 0 <0.000035>
getsockname(8, {sa_family=AF_INET, sin_port=htons(38185), sin_addr=inet_addr("172.20.0.13")}, [112 => 16]) = 0 <0.000012>
getpeername(8, {sa_family=AF_INET, sin_port=htons(9), sin_addr=inet_addr("183.2.172.42")}, [112 => 16]) = 0 <0.000028>
socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 8 <0.000188>
setsockopt(8, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0 <0.000026>
join(8, {sa_family=AF_INET, sin_port=htons(9), sin_addr=inet_addr("183.2.172.185")}, 16) = 0 <0.000158>
getsockname(8, {sa_family=AF_INET, sin_port=htons(60410), sin_addr=inet_addr("172.20.0.13")}, [112 => 16]) = 0 <0.000055>
getpeername(8, {sa_family=AF_INET, sin_port=htons(9), sin_addr=inet_addr("183.2.172.185")}, [112 => 16]) = 0 <0.000019>
socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 8 <0.000029>
join(8, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("183.2.172.42")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000061>
socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 8 <0.000041>
setsockopt(8, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0 <0.000013>
join(8, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("223.5.5.5")}, 16) = 0 <0.000052>
getsockname(8, {sa_family=AF_INET, sin_port=htons(49188), sin_addr=inet_addr("172.20.0.13")}, [112 => 16]) = 0 <0.000009>
getpeername(8, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("223.5.5.5")}, [112 => 16]) = 0 <0.000021>
socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 8 <0.000026>
setsockopt(8, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0 <0.000047>
join(8, {sa_family=AF_INET, sin_port=htons(9), sin_addr=inet_addr("183.2.172.42")}, 16) = 0 <0.000028>
getsockname(8, {sa_family=AF_INET, sin_port=htons(37913), sin_addr=inet_addr("172.20.0.13")}, [112 => 16]) = 0 <0.000018>
getpeername(8, {sa_family=AF_INET, sin_port=htons(9), sin_addr=inet_addr("183.2.172.42")}, [112 => 16]) = 0 <0.000023>
socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 8 <0.000016>
setsockopt(8, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0 <0.000018>
join(8, {sa_family=AF_INET, sin_port=htons(9), sin_addr=inet_addr("183.2.172.185")}, 16) = 0 <0.000018>
getsockname(8, {sa_family=AF_INET, sin_port=htons(48424), sin_addr=inet_addr("172.20.0.13")}, [112 => 16]) = 0 <0.000018>
getpeername(8, {sa_family=AF_INET, sin_port=htons(9), sin_addr=inet_addr("183.2.172.185")}, [112 => 16]) = 0 <0.000012>
socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 8 <0.000019>
join(8, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("183.2.172.42")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000059>
--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---