On Thu, Feb 9, 2017 at 1:41 PM, Jeroen Demeyer <jdeme...@cage.ugent.be> wrote:
> On 2017-02-09 13:29, Erik Bray wrote:
>>
>> I think this can be worked
>> around in Sage by not explicitly closing the master pty until the
>> process has exited.
>
>
> I think this is doing things in the wrong order. Closing a pty is a way to
> signal to a process that it should exit.

I think you're right. It's just surprising how much buggy behavior
this led to in this case.

> This isn't Sage-specific, upstream pexpect/ptyprocess also quits processes
> this way.
>
> If terminate_async() is called, it should kill the process anyway. Do you
> know why this isn't working?

I think it is working--I should have been more explicit though: Cygwin
takes a long time to fork() a process, as it does in
terminate_async().  In the meantime a *lot* of time spent in that
select() loop (it calls select with 0 timeout) and it's a very busy
loop eating up significant CPU time.  By one test I did, I count 29290
select() calls before it sees the SIGTERM.

This isn't such a problem in a normal context because it still exits
after a few seconds.  But when running the test suite it's starting up
multiple maxima instances in rapid succession, all of which get stuck
in this loop simultaneously, slowing each other down, and also slowing
down creation of the processes that start them.

Another possible solution, just for Cygwin (for now, until I can fix
ECL) would be to not use terminate_async on Cygwin, and instead
terminate synchronously.  This still might not help if running the
tests in parallel though?

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

Reply via email to