Overview
| Artifact ID: | 51d427ec57361564f0087b9fa1ae070ba45d47f5799b44cec960c1b698d4ca0d |
|---|---|
| Ticket: | 815e2468064b4324bc4b303b9bafd3ef92803c32
tcl crash on channel thread transfer and fileevent writable in place |
| User & Date: | sebres on 2018-06-12 11:42:30 |
Changes
- icomment:
I tried to test the fix without atomic operations (rewritten atomic-defines similar the last section from current branch if no TCL_THREADS declared, so as (++(p)) and (--(p))). It's not stable as non-atomic (sporadically produces panic "Channel released more than preserved").<br/> <b>So no way without - either atomic or mutex</b> (which IMHO a bit superfluous for incr/decr). Please find enclosed better (faster) test-case without hand-brake in the console (so it reproduces very fast a segfault or panic in original tcl without the fix, resp. without atomic operations also): <pre style="padding-left:10pt"><code> set handleproc { proc handle {chan} { global name other cntr if 0 {;# if {$name eq "master"} { puts -nonewline M if {!([incr cntr] % 100)} {flush stdout} } else { thread::send $other {puts -nonewline s} } } else { if {!([incr cntr] % 50)} { if {$name eq "master"} { puts -nonewline [expr {$cntr % 2500 ? "" : " -- $cntr\n"}]M } else { thread::send $other {puts -nonewline s} } } };# if 0 { thread::transfer $other $chan } else { thread::detach $chan #thread::send $other [list thread::attach $chan] thread::send -async $other [list thread::attach $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 </code></pre> - login: "sebres"
- mimetype: "text/x-fossil-wiki"