Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2020-08-10
16:18 • Closed ticket [7cf7cce423]: windows: `socket -async localhost $port` can hang sp... artifact: 6d44ee7ee7 user: sebres
16:16
windows: replace gethostbyname with getaddrinfo (gethostbyname can hang sporadically, closes [7cf7cc... check-in: ebf745562a user: sebres tags: core-8-5-branch
15:38 • Ticket [7cf7cce423] windows: `socket -async localhost $port` can hang sporadical... artifact: beb100c670 user: sebres
15:38 • New ticket [7cf7cce423]. artifact: ed0826597b user: sebres

windows: `socket -async localhost $port` can hang sporadically in gethostbyname

Closed / Fixed7cf7cce42320c60ca3ed94c3ec59de1694a27f68Created 6 years agoUpdated 6 years ago
Descriptionwiki2020-08-10 15:38:12
Evaluation of socket -async $host $port can hang sporadically on windows. Further investigation shows that this really hang (freezes completely) in CreateSocketAddress when executing gethostbyname. This is not a resolve issue, since it's affected by localhost also and it does not return after timeout, so causes total freeze in calling thread.

The issue is extremely sporadic, but it is better reproducible on Windows 10 box with several tcl-workers simultaneously executing socket -async localhost $port in the cycle.

I think this could be also a reason for other sporadically hanging issues, like [e484a8407c] or [1adeb65446], at least partially (for test cases involving socket calls).

Related to MS documentation:

Developers creating Windows Sockets 2 applications are urged to use the getaddrinfo function instead of gethostbyname.

And since [7e814eaa84] we're using Winsock 2.2 API, it must be fixed.
Anyway on 8.6 using getaddrinfo this behavior is not reproducible at all.

Referenced by1
  • ebf745562awindows: replace gethostbyname with getaddrinfo (gethostbyname can hang sporadically, closes [7cf7cce423]); corresponding to MS (https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-gethostbyname): Developers creating Windows Sockets 2 applications are urged to use the getaddrinfo function instead of gethostbyname check-in2020-08-10 16:16:36
sebres Ticket [7cf7cce423]: 4 changes [History diff]2020-08-10 15:38:59
sebreswiki2020-08-10 16:18:42

Fixed in [ebf745562a] (for 8.5 only).

Log in (anonymous is fine) to add a comment.