Opened 5 years ago

Last modified 5 years ago

#20128 new defect

QEPCAD expect instances are not deleted

Reported by: yzh Owned by:
Priority: major Milestone: sage-7.2
Component: interfaces: optional Keywords: pexpect
Cc: mkoeppe, dimpase, rws, tmonteil, jdemeyer Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by jdemeyer)

sage: x, y = var('x,y')
sage: ellipse = 3*x^2 + 2*x*y + y^2 - x + y - 7
sage: circle = x^2 + y^2 - 3
sage: for i in range(1000): qe = qepcad([ellipse < 0, circle < 0])
OSError: [Errno 35] Resource temporarily unavailable

One gets the following similar error if interact=True option is used.

RuntimeError: unable to start QEPCAD because the command 
'env qe=/Users/yzh/sage/local qepcad' failed: 
Pexpect: pty.fork() failed: [Errno 35] Resource temporarily unavailable

Change History (20)

comment:1 follow-up: Changed 5 years ago by dimpase

Do you know whether this tries to start 200 instances of qepcad?

comment:2 in reply to: ↑ 1 Changed 5 years ago by yzh

Sorry, I don't know. How can I find out? Replying to dimpase:

Do you know whether this tries to start 200 instances of qepcad?

comment:3 Changed 5 years ago by dimpase

What OS do you have this error on? This loop completes on Linux Ubunty 14.10 every time I try (even if I change the range to 2000).

If I start this loop and watch at the same time the output of top I see a lot of python and qepcad processes start. It's not as synchronous as you might think, for some reason; I don't know if it is a bug, I will ask on sage-devel.

comment:4 Changed 5 years ago by mmarco

I see the same behaviour as Dima: no error, but lots of zombie python and qepcad processes (they get killed when I close the sage session)

comment:5 Changed 5 years ago by yzh

I'm using Mac OS Yosemite Version 10.10.4. Actually I had this error when I tried to run qepcad on a series of different inputs in a program. Each time after running a while, Sage (and any other running terminals) crashed with OSError. I give the example in the ticket that uses a loop of 200 same instances for simplicity.

Last edited 5 years ago by yzh (previous) (diff)

comment:6 Changed 5 years ago by dimpase

this might be a general flackiness of pexpect on OSX. Perhaps for your task it's better to communicate with qepcad via files...

comment:7 follow-up: Changed 5 years ago by mkoeppe

It starts 200 instances of qepcad and 200 instances of sage-cleaner.

comment:8 in reply to: ↑ 7 Changed 5 years ago by dimpase

Replying to mkoeppe:

It starts 200 instances of qepcad and 200 instances of sage-cleaner.

not sure about the latter, but it looks it's by design that the interface is meant to solve one formula in qepcad and quit.This is very much different from e.g. pexpect interface to GAP or Maxima.

comment:9 Changed 5 years ago by dimpase

  • Cc jdemeyer added

Jeroen, I wonder if you could have a quick look at the way qepcad interface (ab)uses pexpect; somehow it looks as if pexpect sessions are kept active for no good reason, after the work is done.

Last edited 5 years ago by dimpase (previous) (diff)

comment:10 Changed 5 years ago by dimpase

probably one has to add an explicit call to kill the pexpect interface afer each qe.quit() or qe.finish(), I only don't know how.

comment:11 Changed 5 years ago by jdemeyer

  • Description modified (diff)
  • Summary changed from QEPCAD crashes after a few calls to QEPCAD leaves zombies

comment:12 Changed 5 years ago by jdemeyer

  • Component changed from interfaces to packages: standard
  • Keywords QEPCAD removed
  • Report Upstream changed from N/A to Not yet reported upstream; Will do shortly.
  • Summary changed from QEPCAD leaves zombies to pexpect read_nonblocking() leaves zombies on EOF

comment:13 Changed 5 years ago by jdemeyer

  • Component changed from packages: standard to interfaces: optional
  • Report Upstream changed from Not yet reported upstream; Will do shortly. to N/A
  • Summary changed from pexpect read_nonblocking() leaves zombies on EOF to QEPCAD expect instances are not deleted

comment:14 Changed 5 years ago by jdemeyer

I found two bugs: one in QEPCAD (this ticket) and one in pexpect (see #20178). Fixing any of these two should solve the initially reported problem.

comment:15 Changed 5 years ago by dimpase

  • Milestone changed from sage-7.1 to sage-7.2

ping?

comment:16 Changed 5 years ago by jdemeyer

I haven't investigated further, but if you want to help: construct a minimal testcase (not using qepcad, just pexpect) which exhibits the problem.

comment:17 Changed 5 years ago by jdemeyer

My point is: pexpect can be improved (#20178), but for some reason this problem only exhibits itself with qepcad. I don't understand that last part and I don't like fixing bugs that I don't fully understand.

comment:18 Changed 5 years ago by jdemeyer

Given that #20178 will involve a patch to upstream pexpect, it's especially important to give a simple failing example.

comment:19 follow-up: Changed 5 years ago by dimpase

What is the bug in QEPCAD you found?

I have no experience debugging pexpect interfaces; are there some debugging flags one can turn on, any log files that can be made?

comment:20 in reply to: ↑ 19 Changed 5 years ago by jdemeyer

Replying to dimpase:

What is the bug in QEPCAD you found?

I'm not sure anymore that there is a bug, but there is something which makes the QEPCAD interface "special" since other interfaces do not have this bug. It's just all very unclear to me.

Note: See TracTickets for help on using tickets.