#17650: alarm broken on cygwin
-------------------------------------+-------------------------------------
       Reporter:  gouezel            |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.5
      Component:  porting: Cygwin    |   Resolution:
       Keywords:  ppl, cygwin        |    Merged in:
        Authors:                     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/gouezel/alarm_broken_on_cygwin   |  1a8ecd257246a869941d6407eda677a489e019fa
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by gouezel):

 * status:  new => needs_review
 * cc: vbraun, jpflori (added)
 * keywords:   => ppl, cygwin
 * commit:   => 1a8ecd257246a869941d6407eda677a489e019fa


Old description:

> On cygwin64, the alarm mechanism is broken:
> {{{
> sage: alarm(0.1); sum(xrange(100000000))
> 4999999950000000
> }}}
> instead of the expected interrupt.
>
> I traced the bug to ppl by dichotomy, but what is going on is very
> mysterious to me. Here are my observations.
>
> The included header ppl.hh contains lines akin to
> {{{
> class Parma_Polyhedra_Library::Init {
> public:
>   Init();
>   ~Init();
>   ...
> }
> static Parma_Polyhedra_Library::Init Parma_Polyhedra_Library_initializer;
> }}}
>
> the class' methods are defined in the ppl library. Hence, the ppl module
> makes calls to these methods. If one removes these calls, either by
> commenting the line
> {{{
> static Parma_Polyhedra_Library::Init Parma_Polyhedra_Library_initializer;
> }}}
> or by replacing the above lines with
> {{{
>   Init() {};
>   ~Init() {};
> }}}
> then the alarm issue disappears (but `ppl` is not functional any more, of
> course)

New description:

 On cygwin (32 and 64), the alarm mechanism is broken:
 {{{
 sage: alarm(0.1); sum(xrange(100000000))
 4999999950000000
 }}}
 instead of the expected interrupt.

 I traced the bug by dichotomy to a ppl component named watchdog. Its role
 is similar to alarm, involving signals and interrupts. I guess that, due
 to the peculiarities of cygwin's implementation of signals, watchdog
 somehow intercepts the python signals and does dot send them back.

 watchdog is not an optional component of ppl, so it can not be disabled by
 a configure flag. However, it is disabled on systems that don't have
 `setitimer`. Cygwin has `setitimer`, but a simple hack of ppl's makefile
 can hide it, thereby disabling watchdog and fixing the sage alarm
 mechanism. This is done in the proposed patch.

 A better fix would be to dig into the ppl and cygwin signal mechanism, of
 course...

--

Comment:

 New commits:
 
||[http://git.sagemath.org/sage.git/commit/?id=1a8ecd257246a869941d6407eda677a489e019fa
 1a8ecd2]||{{{disable ppl watchdog on cygwin}}}||

--
Ticket URL: <http://trac.sagemath.org/ticket/17650#comment:6>
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