Artifacts Associated With Ticket 1555698fffffffffffffffffffffffffffffffff
Ticket change [2a54fc0cdb] (rid 118542) by matben on 2006-09-10 09:04:01:
- assignee initialized to: "andreas_kupries"
- cmimetype initialized to: "text/plain"
- comment initialized to:
I was getting weird errors while experimenting with Pats dns package using the code below. What it does is essentially open a tcp socket async to the dns port (53), gets some stuff, and invokes a callback while its socket is still open. In the callback I open another socket async but the writable handler is never invoked if I do dns::cleanup on the dns token (which closes socket). It turned out that the second socket created is identical to the already open one!!! The debug output looks essentially: ---> cb ::dns::1 ... ::dns::1(sock) = sock12 ... socket=sock12 Two different open sockets with identical names!!! This happens consistently on MacOS 10.2.8 Tcl 8.4.9 (sorry for not having a more recent one). I have tested WinXP using 8.4.12 (I guess) and it happened once, and then I couldn't reproduce it anymore. Ideas? Mats package require dns proc cb {token} { global s puts "---> cb $token" parray $token set s [socket -async google.com 80] fconfigure $s -blocking 0 fileevent $s writable writable puts "\t socket=$s" # Try with and without cleanup. dns::cleanup $token } proc writable {args} { global s puts "+++> writable s=$s" close $s } dns::resolve google.com -command cb -protocol tcp - foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "matben"
- subsystem initialized to: "24. Channel Commands"
- title initialized to: "socket name corruption"
- type initialized to: "Bug"
Ticket change [63b3ea201d] (rid 92624) by matben on 2006-09-10 16:04:38:
- priority changed to: "7 High"
Ticket change [58cedf7d82] (rid 117863) by dkf on 2006-09-10 18:37:40:
- foundin changed to: "obsolete: 8.4.9"
- icomment:
Logged In: YES user_id=79902 Arguably, the udp package in use (tcludp?) is at fault for naming its sockets according to the pattern sock%d On the other hand, duplicating the name like that perhaps should lead to the other socket with that name being closed.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
Ticket change [789fa0ffcb] (rid 89995) by matben on 2006-09-11 19:28:23:
- icomment:
Logged In: YES user_id=108900 But I'm using tcp; dns::resolve google.com -command cb -protocol tcp Your thought was also mine for a while. Mats
- login: "matben"
- mimetype: "text/plain"
- username: "matben"
- icomment:
Ticket change [f20184832a] (rid 109456) by dkf on 2006-09-11 20:33:00:
- icomment:
Logged In: YES user_id=79902 The Tcl core uses the socket's FD number to disambiguate channel names. Since those are unique while each socket is open (enforced by the OS) the underlying network package must be using something else. Since I don't know the code well, I don't know what's at fault. What package is the dns package using for its low-level socket management?
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [bdffea39ce] (rid 102003) by patthoyts on 2006-09-12 20:18:12:
- icomment:
File Added - 193148: bug1555698-udp.tcl Logged In: YES user_id=202636 I cannot see any reason why the tcludp package should produce name collisions as it creates socket names the same way that tcl does, namely appending the filedescriptor number to 'sock': sprintf(channelName, "sock%d", statePtr->sock); I cannot get this problem to occur on Windows XP using tcl 8.4.13 or tcl8.5a5 with/without udp-1.0.8. I'm attaching the two test scripts (one just uses tcp sockets - try against a web server, the other uses udp TIME service and needs a host listening for TIME protocol on port 37 tcp and udp.) Perhaps MacOSX will fail with these?
- login: "patthoyts"
- mimetype: "text/plain"
- username: "patthoyts"
- icomment:
Add attachment "bug1555698-udp.tcl" [dde35749f4] (rid 114757) by patthoyts on 2006-09-12 20:18:12.
Add attachment "bug1555698-tcp.tcl" [be59744082] (rid 102058) by patthoyts on 2006-09-12 20:20:46.
Ticket change [8aa4f486e8] (rid 127425) by patthoyts on 2006-09-12 20:20:46:
- icomment:
File Added - 193149: bug1555698-tcp.tcl
- login: "patthoyts"
- mimetype: "text/plain"
- username: "patthoyts"
- icomment:
Ticket change [77e75517ff] (rid 89854) by matben on 2006-09-12 20:49:16:
- icomment:
Logged In: YES user_id=108900 The problem seems unrelated to the udp package since the test case is configured for tcp. The dns package then uses the standard tcp socket as: set s [socket $state(-nameserver) $state(-port)] fconfigure $s -blocking 0 -translation binary -buffering none Pat: using your bug1555698-tcp.tcl I just get a lot of stack traces (after changing ripon to $host in CreateSocket): [Mats-Bengtssons-dator:~/Desktop] matben% tclsh bug1555698-tcp.tcl google.com 80 created sock5 49817 can't get sockname: connection reset by peer while executing "fconfigure $s -sockname" On WinXP I could only see the problem once and then I never reproduced it. MacOSX is using the standard unix socket code so I don't believe there is anything special with that. Unless it is the system socket stack. - login: "matben"
- mimetype: "text/plain"
- username: "matben"
- icomment:
Ticket change [32a4e9b0ba] (rid 93646) by matben on 2006-09-12 21:03:44:
- icomment:
Logged In: YES user_id=108900 Just got Daniels updated cvs to build on 10.2.8 and I can just confirm that the problem persists in 8.4.14 (core-8-4-branch 20060912)
- login: "matben"
- mimetype: "text/plain"
- username: "matben"
- icomment:
Ticket change [ce801343c5] (rid 96070) by matben on 2006-09-12 21:03:45:
- foundin changed to: "obsolete: 8.4.14"
Ticket change [ab21df8dda] (rid 101048) by patthoyts on 2006-10-01 16:54:08:
- priority changed to: "9 Immediate"
Ticket change [ffc380d5c0] (rid 108815) by dkf on 2007-09-21 20:27:49:
- priority changed to: "5 Medium"