Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 50ec4a0619e86b8e4760453e77a47d429438d9a4
Ticket: 894da183c8475264b8070b5b4dbbd6dd72f8dd69
In a thread, switch a non-blocking channel to blocking and close == hang
User & Date: pooryorick on 2015-04-24 18:37:17
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    The following script causes Tcl to hang:
    
    <code><verbatim>
    #! /bin/env tclsh
    
    package require Thread
    
    lassign [chan pipe] pr pw
    
    # Comment this out and the interpreter no-longer hangs.
    chan configure $pw -blocking 0
    
    set tid [thread::create]
    thread::transfer $tid $pw
    thread::send $tid [list variable pw $pw]
    thread::send $tid [list lappend notify_condition $pw]
    thread::send -async $tid {
        #after 5000
        apply {{} {
            variable notify_condition
            variable pw
            for {set i 0} {$i < 10000} {incr i} {
                puts $pw [string repeat [info cmdcount] 15]
            }
            foreach chan $notify_condition {
                chan configure $chan -blocking 1
                close $chan
            }
        }}
        thread::release
    }
    
    after 5000
    set data [read $pr]
    close $pr
    puts {condition occured}
    </verbatim></code>
    
  5. foundin changed to: "8.6.4"
  6. is_private changed to: "0"
  7. login: "pooryorick"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Minor"
  11. status changed to: "Open"
  12. submitter changed to: "pooryorick"
  13. subsystem changed to: "25. Channel System"
  14. title changed to:
    In a thread, switch a non-blocking channel to blocking  and close == hang
    
  15. type changed to: "Bug"