Bug 23396 – [std.socket] getAddresses causes TcpSocket to open UDP sockets first

Status
NEW
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2022-10-08T03:22:45Z
Last change time
2024-12-01T16:40:34Z
Assigned to
No Owner
Creator
Witold Baryluk
Moved to GitHub: phobos#10503 →

Comments

Comment #0 by witold.baryluk+d — 2022-10-08T03:22:45Z
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 ```
Comment #1 by robert.schadek — 2024-12-01T16:40:34Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10503 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB