Opened 7 years ago

Closed 7 years ago

#16474 closed defect (fixed)

timeouts in doctests on OS X 10.9

Reported by: jhpalmieri Owned by:
Priority: critical Milestone: sage-6.3
Component: interfaces Keywords:
Cc: vbraun Merged in:
Authors: Volker Braun Reviewers: John Palmieri
Report Upstream: N/A Work issues:
Branch: 2928b9a (Commits) Commit: 2928b9a4b17c7ccb49a72ee1f1e39b734803ae7e
Dependencies: Stopgaps:

Description (last modified by vbraun)

There are frequent timeouts when doctesting on OS X with pexpect interfaces, in particular Singular. For example:

$ ./sage -tp src/doc/en/constructions

sage -t src/doc/en/constructions/algebraic_geometry.rst  # Timed out
sage -t src/doc/en/constructions/polynomials.rst  # Timed out

These became much more frequent by the changes in the Singular/pexpect interface from #15631 on two buildbots:

  • OSX 10.9 (Oxford)
  • Ubuntu 8.04 (UW)
  • This happens mostly during parallel doctesting, and disappers when the system load is low

Other build bots do not seem to be affected, so its a likely pty kernel bug.

Change History (11)

comment:1 Changed 7 years ago by vbraun

  • Cc vbraun added

comment:2 Changed 7 years ago by dimpase

even after reverting the corresponding commit from #15631 I still get lots of doctest timeouts.

comment:3 Changed 7 years ago by jhpalmieri

I'm not suggesting this as a fix (because I don't know anything about the pexpect interface), but if I make this one change:

  • src/sage/interfaces/

    diff --git a/src/sage/interfaces/ b/src/sage/interfaces/
    index 576fcc7..97ed05d 100644
    a b class Singular(Expect): 
    378378        """
    379379        prompt = '> '
    380380        Expect.__init__(self,
    381                         terminal_echo=False,
     381                        terminal_echo=True,
    382382                        name = 'singular',
    383383                        prompt = prompt,
    384384                        command = "Singular -t --ticks-per-sec 1000", #no tty and fine grained cputime()

then I don't get the timeouts any more. (I get other doctest failures because of this, but no timeouts.)

comment:4 Changed 7 years ago by dimpase

in case, note #16260#comment:62

comment:5 Changed 7 years ago by vbraun

  • Description modified (diff)

I've debugged the issue on OSX 10.9 and when the hang happens

  • Singular does print its header and prompt (captured with dtrace)
  • Python never sees any output from the subprocess, the first select() in pexpect.read_nonblocking hangs forever.

One way to reduce the likelihood of the hang is to insert a sleep before first reading from the subproces (in expect._start)

comment:6 Changed 7 years ago by vbraun

Sleeping 100ms when starting Singular reduces the failure rate in sage -t --long src/sage/interfaces/ from about 1/10 to 1/1000 fwiw.

comment:7 Changed 7 years ago by vbraun

  • Branch set to u/vbraun/timeouts_in_doctests_on_os_x_10_9

comment:8 Changed 7 years ago by vbraun

  • Authors set to Volker Braun
  • Commit set to 2928b9a4b17c7ccb49a72ee1f1e39b734803ae7e

The branch attached is obviously a no-op, and just moves the setecho(0) further down after we read the first prompt. But it seems to improve things in my limited testing.

New commits:

2928b9aFix Singular pexpect timeouts on some platforms

comment:9 Changed 7 years ago by vbraun

  • Status changed from new to needs_review

This seems to fix it, I haven't seen another failure in sage -t --long src/sage/interfaces/

comment:10 Changed 7 years ago by jhpalmieri

  • Reviewers set to John Palmieri
  • Status changed from needs_review to positive_review

Oh, very nice. This fixes it on two OS X 10.9 machines.

comment:11 Changed 7 years ago by vbraun

  • Branch changed from u/vbraun/timeouts_in_doctests_on_os_x_10_9 to 2928b9a4b17c7ccb49a72ee1f1e39b734803ae7e
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.