digitalmars.D.bugs - [Issue 23396] New: [std.socket] getAddresses causes TcpSocket to
- d-bugmail puremagic.com (54/54) Oct 07 2022 https://issues.dlang.org/show_bug.cgi?id=23396
https://issues.dlang.org/show_bug.cgi?id=23396 Issue ID: 23396 Summary: [std.socket] getAddresses causes TcpSocket to open UDP sockets first Product: D Version: D2 Hardware: All URL: http://dlang.org/phobos/ OS: Linux Status: NEW Severity: major Priority: P3 Component: phobos Assignee: nobody puremagic.com Reporter: witold.baryluk+d gmail.com Linux amd64. Debian testing. Verified on: - dmd 2.100.2-0 - gdc 12.2.0 - gdc 10.2.1-6 Also I got it sporadically when using: - ldc2 1:1.30.0-1+b1 (based on DMD v2.100.1 and LLVM 14.0.6) ``` void main() { import std; auto addresses = getAddress("www.google.com", 3333); auto sock = new TcpSocket(addresses[0]); } ``` running under strace: ``` $ strace -e close,socket,connect,getsockname ./a.out >/dev/null ... socket(AF_INET6, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_IP) = 3 connect(3, {sa_family=AF_INET6, sin6_port=htons(3333), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "2a00:1450:400a:801::2004", &sin6_addr), sin6_scope_id=0}, 28) = 0 getsockname(3, {sa_family=AF_INET6, sin6_port=htons(36873), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "2a02:REDACTED", &sin6_addr), sin6_scope_id=0}, [28]) = 0 connect(3, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0 connect(3, {sa_family=AF_INET, sin_port=htons(3333), sin_addr=inet_addr("142.250.203.100")}, 16) = 0 getsockname(3, {sa_family=AF_INET6, sin6_port=htons(49645), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "::ffff:10.0.0.READACTED", &sin6_addr), sin6_scope_id=0}, [28]) = 0 close(3) = 0 socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP) = 3 connect(3, {sa_family=AF_INET6, sin6_port=htons(3333), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "2a00:1450:400a:801::2004", &sin6_addr), sin6_scope_id=0}, 28 ``` --
Oct 07 2022