Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4ab75e09e642f82aad4765d2520ac937f560f25d806bd2978a4c0ccb571e2f53
Ticket: 06f19cc401de076eea76538424796d1ee54ed221
socket_*-12.3 crashes on Windows 11
User & Date: dkf on 2025-11-25 14:32:35
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    In what appears to be a recurrence of [217794], I'm getting crashes in <tt>socket-*-12.3</tt> (both address families, commit [4724603ffb] on <tt>trunk</tt>) apparently due to inheritance of the socket, but only when the process exits with an event loop running. Here's a typical piece of output:
    
    <verbatim>
    ==== socket_inet-12.3 testing inheritance of accepted sockets FAILED
    ==== Contents of test case:
    
        # Launch the script2 process and connect to it. See how long the socket
        # stays open
        ## exec [interpreter] script2 &
        set p [open "|[list [interpreter] $path(script2)]" r]
        gets $p listen
        set f [socket $localhost $listen]
        fconfigure $f -buffering full -blocking 0
        fileevent $f readable [list getdata $f]
        # If the socket is still open after 5 seconds, the script1 process must
        # have inherited the accepted socket.
        set failed 0
        set after [after 5000 [list set x "accepted socket was inherited"]]
        proc getdata { file } {
            # Read handler on the client socket.
            global x
            global failed
            set status [catch {read $file} data]
            if {$status != 0} {
                set x "read failed, error was $data"
            } elseif {[string compare {} $data]} {
            } elseif {[fblocked $file]} {
            } elseif {[eof $file]} {
                set x "accepted socket was not inherited"
            } else {
                set x "impossible case"
            }
            return
        }
        vwait x
        set x
    
    ---- Test cleanup failed:
    child killed: segmentation violation
    ---- errorInfo(cleanup): child killed: segmentation violation
        while executing
    "close $p"
        ("uplevel" body line 5)
        invoked from within
    "uplevel 1 $cleanup"
    ---- errorCode(cleanup): CHILDKILLED 18364 SIGSEGV {segmentation violation}
    ==== socket_inet-12.3 FAILED
    </verbatim>
    
    The crash comes from one of the subprocesses launched, but <i>only when the innermost subprocess does an exit with the event loop still running;</i> altering the callbacks so that the subprocess exits after stopping the event loop (<tt>socket_*.12.4</tt>) prevents the crash.
    
    I don't think the code should crash. I don't know why the code is crashing. I've marked the test as a <tt>knownBug</tt>.
    
  5. is_private changed to: "0"
  6. login: "dkf"
  7. priority changed to: "5 Medium"
  8. private_contact changed to: "f6b536f9c1ed4b589e96e38fb613afc3d8991783"
  9. resolution changed to: "None"
  10. severity changed to: "Minor"
  11. status changed to: "Open"
  12. submitter changed to: "dkf"
  13. subsystem changed to: "27. Channel Types"
  14. title changed to: "socket_*-12.3 crashes on Windows 11"
  15. type changed to: "Bug"