Opened 7 years ago

Closed 3 years ago

#20178 closed defect (worksforme)

pexpect read() leaves zombies on EOF

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: packages: standard Keywords:
Cc: dimpase, yzh, mkoeppe, jpflori Merged in:
Authors: Reviewers:
Report Upstream: Not yet reported upstream; Will do shortly. Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


If read_nonblocking() detects an EOF condition, it should call isalive() to reap the child process.

Change History (6)

comment:1 Changed 7 years ago by dimpase

Cc: dimpase added

comment:2 Changed 7 years ago by mkoeppe

Cc: yzh mkoeppe added

comment:3 Changed 7 years ago by dimpase

Milestone: sage-7.1sage-7.2

any progress on this?

comment:4 Changed 6 years ago by jpflori

Cc: jpflori added

Don't we also have an issue with sage-cleaner?

comment:5 Changed 3 years ago by embray

Milestone: sage-7.2

comment:6 Changed 3 years ago by embray

Milestone: sage-duplicate/invalid/wontfix
Resolution: worksforme
Status: newclosed

From my experience on #18267 apparently now it does, as I'm getting tracebacks ending with:

      File "/home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/pexpect/", line 369, in expect_list
        return exp.expect_loop(timeout)
      File "/home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/pexpect/", line 111, in expect_loop
        incoming = spawn.read_nonblocking(spawn.maxread, timeout)
      File "/home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/pexpect/", line 469, in read_nonblocking
      File "/home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/pexpect/", line 704, in isalive
        alive = ptyproc.isalive()
      File "/home/embray/src/sagemath/sage/local/lib/python2.7/", line 35, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/pexpect/", line 25, in _wrap_ptyprocess_err
        raise ExceptionPexpect(*e.args)
    ExceptionPexpect: isalive() encountered condition where "terminated" is 0, but there was no child process. Did someone else call waitpid() on our process?

Unfortunately, sometimes sage-cleaner reaps the zombie process during isalive() resulting in this exception, which we don't handle in some cases, but that's a separate issue IIUC.

Note: See TracTickets for help on using tickets.