Opened 4 years ago

Closed 4 months 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:

Description

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

Change History (6)

comment:1 Changed 4 years ago by dimpase

  • Cc dimpase added

comment:2 Changed 4 years ago by mkoeppe

  • Cc yzh mkoeppe added

comment:3 Changed 4 years ago by dimpase

  • Milestone changed from sage-7.1 to sage-7.2

any progress on this?

comment:4 Changed 3 years ago by jpflori

  • Cc jpflori added

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

comment:5 Changed 4 months ago by embray

  • Milestone sage-7.2 deleted

comment:6 Changed 4 months ago by embray

  • Milestone set to sage-duplicate/invalid/wontfix
  • Resolution set to worksforme
  • Status changed from new to closed

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/spawnbase.py", line 369, in expect_list
        return exp.expect_loop(timeout)
      File "/home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/pexpect/expect.py", 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/pty_spawn.py", line 469, in read_nonblocking
        self.isalive()
      File "/home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/pexpect/pty_spawn.py", line 704, in isalive
        alive = ptyproc.isalive()
      File "/home/embray/src/sagemath/sage/local/lib/python2.7/contextlib.py", line 35, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/pexpect/pty_spawn.py", 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.