Overview
| Artifact ID: | 5cf3f5cc3965e0a369cfbabeb2f70825d10a6c2c0f36fc75950a1535013a9d0c |
|---|---|
| Ticket: | 815e2468064b4324bc4b303b9bafd3ef92803c32
tcl crash on channel thread transfer and fileevent writable in place |
| User & Date: | oehhar on 2018-06-08 07:34:54 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
<h1>Summary</h1> Transfering a channel to another thread by "thread::transfer" with a "fileevent writable" on the channel crashes tclsh after around 20 tries on Linux and Windows. The crash goes away, if the file event is cleared before the transfer. <h1>Crash</h1> Test script: <verbatim> package require Thread set handleproc { proc handle {chan} { global name other if {$name eq "master"} { puts $name } else { thread::send $other "puts slave" } thread::transfer $other $chan thread::send $other [list fileevent $chan writable [list handle $chan]] } } eval $handleproc set name master set other [thread::create] thread::send $other [list set name slave] thread::send $other [list set other [thread::id]] thread::send $other $handleproc set nulldev [dict get {unix /dev/null windows NUL} $tcl_platform(platform)] set chan [open $nulldev RDWR] handle $chan vwait forever </verbatim> <h1>Demonstration that it works without fileevent active</h1> The following script switches the event of before the transfer. It does not crash: <verbatim> package require Thread set handleproc { proc handle {chan} { global name other if {$name eq "master"} { puts $name } else { thread::send $other "puts slave" } thread::transfer $other $chan thread::send $other [subst { fileevent $chan writable { fileevent $chan writable {} after 0 handle $chan } }] } } eval $handleproc set name master set other [thread::create] thread::send $other [list set name slave] thread::send $other [list set other [thread::id]] thread::send $other $handleproc set nulldev [dict get {unix /dev/null windows NUL} $tcl_platform(platform)] set chan [open $nulldev RDWR] handle $chan vwait forever </verbatim> <h1>References</h1> * Discussion thread on the core list titled: "TCL (Windows) socket driver and sending fd to another Thread" started 2018-06-07 * Bug report and test script by Reinhard Max * cause analysis by Christian Werner - foundin changed to: "8.6.8"
- is_private changed to: "0"
- login: "oehhar"
- priority changed to: "5 Medium"
- private_contact changed to: "0f366eb3e9e2fcab52b8ebacd197db9047186a5f"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "oehhar"
- subsystem changed to: "49. Threading"
- title changed to:
tcl crash on channel thread transfer and fileevent writable in place
- type changed to: "Bug"