Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Closing a pipe to a busy process blocks even when -blocking

Closed / Out of Date219255ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 12 years ago
Descriptionplain2000-10-26 05:04:13
OriginalBugID: 5924 Bug
Version: 8.3.1
SubmitDate: '2000-06-20'
LastModified: '2000-09-11'
Severity: CRIT
Status: Assigned
Submitter: lfb
ChangedBy: davidg
RelatedBugIDs: 710
OS: Windows NT
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


Closing a pipe to a busy process blocks on Windows even after you have turned blocking off on the channel.

Try running this script in a tclsh on Windows:
set pipe [open "| tclsh.exe doforever.tcl" r+]
fconfigure $pipe -blocking 0
close $pipe

Contents of doforever.tcl:
while {1} {}

Expected Result:
The primary process closes the pipe and does not block.

Actual Result:
The primary process blocks.



We discovered this problem in the Ajuba2 Server process pool.  If we try to close the pipe to a busy interpreter, the server blocks.
--

A related bug was fixed on the Unix side, but the Windows side uses
a different sort of closedown functions.  Has to be further investigated. 
-- 09/06/2000 hobbs
dkfplain2001-01-09 22:20:08
See also Bug #119252
dgp Ticket [219255ffff]: 1 change [History diff]2001-04-05 08:20:12
andreas_kupriesplain2001-09-08 06:40:48
Logged In: YES 
user_id=75003

Rather bug #219252 after renumbering tango.
dkfhtml2014-11-03 17:44:09

Wasn't there something done in this area recently?

dgpplain2014-11-03 20:45:37
Looks related to TIP 398.
ferrieuxplain2014-11-03 23:12:16
Yes. Since TIP 398 was applied to core on 2012-04-28 (http://core.tcl.tk/tcl/info/efc6bbd2cb), and includes an explicit test (io-29.33b), I would assume that a Windows failure would have been reported by now. Also, the patch lies in the generic part of the IO system...

Passing the ball to someone with a Windows dev environment to check: Jan.
oehharwiki2014-11-04 10:59:51

I have made the tests on:

  • TCL 8.5.12
  • TCL 8.6.3rc1

and there is no block, so the issue does not arise.

Platform: WIndows Vista 32 bit, Compiled with makefilevc and vc6.

Harald

C:\test>tcl8.6.3\win\Release\tclsh86t.exe
% set pipe [open "| C:/test/tcl8512/bin/tclsh85.exe doforever.tcl" r+]
file6b5cc0
% fconfigure $pipe -blocking 0
% close $pipe
% exit

C:\test>tcl8512\bin\tclsh85.exe
% set pipe [open "| C:/test/tcl8512/bin/tclsh85.exe doforever.tcl" r+]
file1aa5e28
% fconfigure $pipe -blocking 0
% close $pipe
% exit

jan.nijtmansplain2014-11-04 12:03:58
Thanks, Harald, for checking this!

Just to be sure, I did the same test (with MinGW-compiled tclsh), and getting the same results: Nothing blocks. Therefore closing.
Log in (anonymous is fine) to add a comment.