Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2a54fc0cdb52f7aa63a19cc6c119bb2d96e07c8f
Ticket: 1555698fffffffffffffffffffffffffffffffff
socket name corruption
User & Date: matben on 2006-09-10 09:04:01
Changes

  1. assignee changed to: "andreas_kupries"
  2. cmimetype changed to: "text/plain"
  3. comment changed 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 changed to: "None"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "matben"
  10. subsystem changed to: "24. Channel Commands"
  11. title changed to: "socket name corruption"
  12. type changed to: "Bug"