Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-10-22
17:19 • Ticket [3590287fff] Proc hangs when channel not closed status still Closed w... artifact: 3a49b82594 user: serhiy.storchaka
2026-10-12
18:04 • Closed ticket [3590287fff]. artifact: c049c5c22d user: serhiy.storchaka
2012-11-28
11:15 • Ticket [3590287fff]: 4 changes artifact: 462a68e790 user: blacksqr
10:30 • Ticket [3590287fff]: 4 changes artifact: 4e7ddf771d user: blacksqr
02:05 • Ticket [3590287fff]: 4 changes artifact: 0b71c6cdcd user: andreas_kupries
01:52 • Ticket [3590287fff]: 4 changes artifact: b778f88e3e user: andreas_kupries
01:49 • Ticket [3590287fff]: 4 changes artifact: 10b670998c user: andreas_kupries
01:16 • Ticket [3590287fff]: 4 changes artifact: 771d428f74 user: dgp
01:15 • Ticket [3590287fff]: 6 changes artifact: dc1ca3d8e2 user: dgp
2012-11-27
20:24 • Ticket [3590287fff]: 4 changes artifact: 6e8b8b9a6e user: dkf
20:22 • Ticket [3590287fff]: 4 changes artifact: 2f2dadca28 user: dkf
06:29 • New ticket [3590287fff]. artifact: c59f962d6f user: blacksqr

Proc hangs when channel not closed

Closed / Works For Me3590287fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 41 days ago
Descriptionplain2012-11-27 06:29:41
A proc that attempts to read output from an external process hangs if the process output channel isn't closed before attempting to return.

This proc runs fine with e.g. "run_cmd ls":

proc run_cmd {cmd} {
set channel [open "| $cmd"]
chan event $channel readable "set ::ready_$channel {}"
vwait ::ready_$channel
set result [read $channel]
close $channel
return $result
}

Now edit the above proc by commenting out the close command.  When executed it never returns.

Tested on 8.5.11 and 8.6.0.0b8 on Ubuntu 10.04.  ActiveState distribution.
dkfplain2012-11-27 20:22:10
Can't reproduce with 8.6 trunk or 8.5 tip.
dkfplain2012-11-27 20:24:10
(Well, assuming that you're reporting a problem that's cross-platform; I tested on OSX…)
dgpplain2012-11-28 01:15:50
Built Tcl 8.5.11 from source on a Centos 5 system.
Tried both --enable-threads and --disable-threads.
Cannot reproduce the reported behavior.

Is ActiveTcl different in some bug-enabling way?
Or can/should we blame Ubuntu?
dgpplain2012-11-28 01:16:38
Are you seeing the hang in [vwait] ?
or something else?
andreas_kupriesplain2012-11-28 01:49:03
Using the ActiveTcl 8.6 build from last night, based on the "core-8-6-0-rc" branch (rev 75ea3a482f0b86), on a Linux 2.6.17 system, (glibc2.3, Fedora FC4 Stentz), I am unable to reproduce the problem.
andreas_kupriesplain2012-11-28 01:52:51
Installed the same build on my machine at home (Ubuntu 7.04 feisty).
Does not reproduce there either.
I have two more Ubuntu machines I can test on, and will.

Oh, this was all 32bit so far.
andreas_kupriesplain2012-11-28 02:05:35
Next, Ubuntu 9.10 karmic, on a 64bit machine. Tested both 32 and 64 bit builds of last night's AT 8.6. Unable to reproduce.

Last, Ubuntu 11.04 natty, again a 64 bit machine. Tested only the 64 bit build. Unable to reproduce. Could not test 32bit build, does not run. Likely that I have not installed the 32bit compat libs for this machine.
blacksqrplain2012-11-28 10:30:01
I was using Tkcon when I found and isolated the problem.  Maybe there is an issue with interaction of Tkcon's event loop and the problem code.
blacksqrplain2012-11-28 11:15:19
I've confirmed that the problem occurs when running in Tkcon, but not in tclsh running in a terminal.  Sorry for the confusion.
serhiy.storchakawiki2026-10-12 18:04:16

Does not hang in tclsh 8.6, 9.0 and 9.1. As noted below, it only happened in tkcon, which is not part of Tcl.

serhiy.storchaka Ticket [3590287fff]: 3 changes [History diff]2026-10-22 17:19:24
Log in (anonymous is fine) to add a comment.