[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

expect eats all the ptys



Hi,
 I'm not on the list, so CC'ing me is preferred.

  I was trying to track down why psmisc tests failed[1]. The issue is the testsuite fails, or halts. When I try to run it, I run out of ptys and have a bunch of /herd/term processes

It seems that expect, or tcl, is not "releasing" the ptys. I don't get the same issue on Linux. A small test script demonstrates the problem.

$ cat test.exp
#!/usr/bin/expect
for { set i 0 } {$i < 66} {incr i} {
        send_user "Try $i\n"
        spawn true
        wait
}

=========
Try 61
spawn true
The system only has a finite number of ptys and you have many of them in use.  The usual reason for this is that you forgot (or didn't know) to call "wait" after closing each of them.
    while executing
==========

It doesn't matter what spawn is starting (psmisc uses killall) the result is the same. 60ish spawns and it dies.

spawn creates a new process and links the ptys, wait waits for the process to die, if you change the "spawn true" to "spawn sleep 2" you'll see the script slow down.

The script completes, ps shows no lurking scripts or true programs and yet the problem exists.

expect should remove the ptys when its finished with the spawn, I'm not sure if it is a expect issue or a Hurd issue.

 - Craig


1: https://buildd.debian.org/status/fetch.php?pkg=psmisc&arch=hurd-i386&ver=23.6-1&stamp=1670967981&raw=0

Reply to: