|
2026-11-22
| ||
| 22:59 | • Closed ticket [d48728e10b]: Blocking gets on a chan push transformed channel... artifact: e4218c487a user: jan.nijtmans | |
|
2026-10-30
| ||
| 13:32 | Fix [d48728]: don't wait in a blocking "gets" on a channel with a reflected transform check-in: 3989a00b66 user: jan.nijtmans tags: core-8-6-branch | |
| 11:33 | Fix [d48728]: don't wait in a blocking "gets" on a channel with a reflected transform check-in: b337a51d42 user: jan.nijtmans tags: core-9-0-branch | |
| 09:55 | Fix [d48728]: don't wait in a blocking "gets" on a channel with a reflected transform check-in: 0d03b1f576 user: jan.nijtmans tags: trunk, main | |
|
2026-10-20
| ||
| 18:11 | • Ticket [d48728e10b] Blocking gets on a chan push transformed channel waits f... artifact: 9cf90d6a28 user: serhiy.storchaka | |
|
2026-10-17
| ||
| 11:39 | • Ticket [d48728e10b]: 3 changes artifact: ef8f35ffa6 user: serhiy.storchaka | |
| 11:38 | Fix [d48728e10b]: a blocking [gets] on a channel with a reflected transform waited for 4096 bytes or... check-in: 8d3bc19e9d user: serhiy.storchaka tags: transform-short-read | |
| 10:51 | • New ticket [d48728e10b] Blocking gets on a chan push transformed channel wai... artifact: 230bd19372 user: serhiy.storchaka | |
Blocking [gets] on a [chan push] transformed channel waits for 4096 bytes or EOF
Repro with a pipe (a socket behaves the same):
proc xform {cmd handle args} {
switch -- $cmd {
initialize {return {initialize finalize read write}}
finalize {}
read - write {return [lindex $args 0]}
}
}
# child writes three lines and keeps its stdout open for 3 seconds
set f [open [list | [info nameofexecutable] << {
puts -nonewline "one\ntwo\nthree\n"; flush stdout; after 3000
}] r]
chan push $f xform
after 500
set t0 [clock milliseconds]
set line [gets $f]
puts "gets -> $line after [expr {[clock milliseconds]-$t0}] ms"
Actual: gets -> one after 2500 ms (returns only when the child exits).
Expected: gets -> one after 0 ms, as without the [chan push].
Cause: ReflectInput() in generic/tclIORTrans.c loops "until the request is satisfied" and calls Tcl_ReadRaw() on the parent channel again after it already has data. In blocking mode that second read blocks. Only the non-blocking case returns a short read (when Tcl_InputBlocked() reports it). A plain channel driver returns what one read gives, so ReflectInput() could stop reading from the parent once it has some data.
The loop dates from the TIP #230 implementation [057ba9eab5]. Reproduced with 8.6.0 through 8.6.18, 9.0.5 and main (Linux, pipes and sockets).
8d3bc19e9dFix [d48728e10b]: a blocking [gets] on a channel with a reflected transform waited for 4096 bytes or EOF although a line was available. ReflectInput now returns a short read once it has data instead of reading the parent channel again. check-in2026-10-17 11:38:30
Proposed fix in branch transform-short-read: ReflectInput() returns a short read once it has data, as other channel drivers do; [gets] and [read] ask again if they need more. Test iortrans-bug-d48728e10b.
Merged to [trunk], core-9-0-branch and core-8-6-branch
Many thanks!