#17924: Race condition in pexpect
-------------------------------------+-------------------------------------
       Reporter:  Vincent.Neri       |        Owner:
           Type:  defect             |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.8
      Component:  interfaces         |   Resolution:
       Keywords:  docker             |    Merged in:
        Authors:  Jeroen Demeyer,    |    Reviewers:  Vincent Neri
  Volker Braun                       |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  6a759cd704efd7d7b2109b8c58e2621074ea3b07
  u/jdemeyer/failure_in_doctest_framework_when_running_in_docker|     Stopgaps:
   Dependencies:  #17686             |
-------------------------------------+-------------------------------------

Comment (by jdemeyer):

 Replying to [comment:42 vbraun]:
 > there is actually no !SystemExit caught.
 Wrong...

 Here is what really happens:
 1. `pexpect` calls `os.fork()`, creating 2 Python processes.
 1. In the child process, `pexpect` creates a `pty` and redirects
 stdin/stdout/stderr to this `pty`. As a consequence, anything `print`ed by
 the child process is not seen.
 1. The child process receives a `SIGHUP`, which (due to the interrupt code
 in Sage) raises `SystemExit`.
 1. The child process catches `SystemExit` and runs the code which is
 really meant for the parent process (this is the bug that #17686 fixes).
 1. The child process puts something in the queue, filling it.
 1. The parent process also tries to put something in the queue, which
 fails.

--
Ticket URL: <http://trac.sagemath.org/ticket/17924#comment:43>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to