Skip to content
Tcl Source Code History Of Ticket 1555698fff
Login

History Of Ticket 1555698fff

Artifacts Associated With Ticket 1555698fff

  1. Ticket change [2a54fc0cdb] (rid 118542) by matben on 2006-09-10 09:04:01:

    1. assignee initialized to: "andreas_kupries"
    2. cmimetype initialized to: "text/plain"
    3. 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 
      
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "matben"
    10. subsystem initialized to: "24. Channel Commands"
    11. title initialized to: "socket name corruption"
    12. type initialized to: "Bug"
  2. Ticket change [63b3ea201d] (rid 92624) by matben on 2006-09-10 16:04:38:

    1. priority changed to: "7 High"
  3. Ticket change [58cedf7d82] (rid 117863) by dkf on 2006-09-10 18:37:40:

    1. foundin changed to: "obsolete: 8.4.9"
    2. 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.
      
      
    3. login: "dkf"
    4. mimetype: "text/plain"
    5. username: "dkf"
  4. Ticket change [789fa0ffcb] (rid 89995) by matben on 2006-09-11 19:28:23:

    1. 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
      
      
      
    2. login: "matben"
    3. mimetype: "text/plain"
    4. username: "matben"
  5. Ticket change [f20184832a] (rid 109456) by dkf on 2006-09-11 20:33:00:

    1. 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?
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  6. Ticket change [bdffea39ce] (rid 102003) by patthoyts on 2006-09-12 20:18:12:

    1. 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?
      
      
    2. login: "patthoyts"
    3. mimetype: "text/plain"
    4. username: "patthoyts"
  7. Add attachment "bug1555698-udp.tcl" [dde35749f4] (rid 114757) by patthoyts on 2006-09-12 20:18:12.

  8. Add attachment "bug1555698-tcp.tcl" [be59744082] (rid 102058) by patthoyts on 2006-09-12 20:20:46.

  9. Ticket change [8aa4f486e8] (rid 127425) by patthoyts on 2006-09-12 20:20:46:

    1. icomment:
      
      
      File Added - 193149: bug1555698-tcp.tcl
      
      
      
    2. login: "patthoyts"
    3. mimetype: "text/plain"
    4. username: "patthoyts"
  10. Ticket change [77e75517ff] (rid 89854) by matben on 2006-09-12 20:49:16:

    1. 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.
      
      
    2. login: "matben"
    3. mimetype: "text/plain"
    4. username: "matben"
  11. Ticket change [32a4e9b0ba] (rid 93646) by matben on 2006-09-12 21:03:44:

    1. 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)
      
      
    2. login: "matben"
    3. mimetype: "text/plain"
    4. username: "matben"
  12. Ticket change [ce801343c5] (rid 96070) by matben on 2006-09-12 21:03:45:

    1. foundin changed to: "obsolete: 8.4.14"
  13. Ticket change [ab21df8dda] (rid 101048) by patthoyts on 2006-10-01 16:54:08:

    1. priority changed to: "9 Immediate"
  14. Ticket change [ffc380d5c0] (rid 108815) by dkf on 2007-09-21 20:27:49:

    1. priority changed to: "5 Medium"