Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-05
08:20 • Ticket [218492ffff] close waits for process to complete (should reap in backgrou... artifact: b4a755b29a user: dgp
2000-10-26
08:23 • Closed ticket [218492ffff]. artifact: 74a70a2244 user: welch
01:01 • New ticket [218492ffff]. artifact: a935be57bb user: nobody

close waits for process to complete (should reap in backgrou

Closed / Fixed218492ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:01:17
OriginalBugID: 710 Bug
Version: 8.0.3
SubmitDate: '1998-10-13'
LastModified: '1999-12-03'
Severity: SER
Status: Released
Submitter: admin
ChangedBy: hobbs
RelatedBugIDs: 1356 1417 1682 5924
OS: All Unix
FixedDate: '1999-12-03'
FixedInVersion: 8.2.3
ClosedDate: '2000-10-25'


This is a bug that was officially fixed  at 7.5p1 (below is  an entry
in the 'changes' file:)

  6/10/96 (bug fix) Changes the Tcl close command so that it no longer
  waits on nonblocking pipes for the piped processes to exit; instead it
  reaps them in the background. (JL)

Today, 8.0.3, at least on  Solaris and NT, but I think also everywhere
else, the following code blocks on close:

        set f [open "|cmd" r]
        fconfigure $f -blocking 0
        close $f

(where cmd is something that sleeps, writing nothing, e.g. sleep 9999)

So  the  problem  is  what's  called  'reaping  in   the  background'.
Apparently (looking at the source) it is done in foreground.

 Note anyway that  on unix  at  least, all this is  handled in  a very
strange way.  A more natural  implementation would register  a SIGCHLD
handler which would *then* trigger the reaping.


4/17/99 - redman - confirmed on NT with 8.1b3+.  The close is waiting for the process to complete.

>My vote:  although it's an annoying little problem,
>it's been there for a while and will take too much
>time to fix for 8.1.  Maybe we can get to these in
>8.1.1. -- Scott R.

Confirmed with 8.2 on Sol7. 
-- 10/21/1999 hobbs

Adding
    psPtr->isNonBlocking = (mode == TCL_MODE_NONBLOCKING);
before the return in unix/tclUnixPipe.c:PipeBlockModeProc
seems to solve the problem. 
-- 11/29/1999 hobbs
welch Closed ticket [218492ffff]. [History diff]2000-10-26 08:23:17
dgp Ticket [218492ffff]: 3 changes [History diff]2001-04-05 08:20:13
Log in (anonymous is fine) to add a comment.