Opened 9 years ago

Closed 8 years ago

#9361 closed defect (fixed)

Maxima timeout on Mac OS X 10.4 (Tiger)

Reported by: kcrisman Owned by: tbd
Priority: critical Milestone: sage-5.0
Component: packages: standard Keywords:
Cc: GeorgSWeber, kcrisman Merged in: sage-5.0.beta0
Authors: Jeroen Demeyer Reviewers: Karl-Dieter Crisman
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by jdemeyer)

This has been reported on more than one Mac running OSX 10.4 Tiger:

$ ./sage -t devel/sage/sage/interfaces/maxima.py
sage -t  "devel/sage/sage/interfaces/maxima.py"
*** *** Error: TIMED OUT! PROCESS KILLED! *** ***

         [361.3 s]

----------------------------------------------------------------------
The following tests failed:


        sage -t  "devel/sage/sage/interfaces/maxima.py" # Time out
Total time for all tests: 361.3 seconds

This is because on OS X 10.4, maxima takes a long time (a few seconds to a minute) to process an interrupt. Sage only waits 2 seconds for an interrupt and thinks that Maxima is stuck. It naively sends more interrupts which totally lock up Maxima. The work-around is simply to send only 1 interrupt and wait...

With the patch:

$ ./sage -t devel/sage/sage/interfaces/maxima.py
sage -t  "devel/sage/sage/interfaces/maxima.py"
         [129.5 s]

----------------------------------------------------------------------
All tests passed!
Total time for all tests: 130.0 seconds

Attachments (1)

9361_maxima_timeout.patch (1.5 KB) - added by jdemeyer 8 years ago.

Download all attachments as: .zip

Change History (15)

comment:1 Changed 9 years ago by kcrisman

  • Description modified (diff)

comment:2 Changed 9 years ago by kcrisman

  • Description modified (diff)
  • Summary changed from Maxima timeout when creating tab completion list on Mac PPC to Maxima timeout when creating tab completion list on Mac Tiger

See also this thread on sage-devel for some indication of how to track it down, perhaps via #4180.

comment:3 Changed 9 years ago by kcrisman

Update: on this release discussion it seems that Macintel does not have this issue anymore:

> Georg, I know your processor is faster than mine, but how long did the 
> Maxima interface test take? 


Cough, cough, 
not so really long, snippet from "testlong.log": 
sage -t  -long -force_lib "devel/sage/sage/interfaces/maxima.py" 
         [39.7 s] 
There seems to be some strange thing ongoing ... 

But it still times out at whatever one chooses on PPC.

comment:4 Changed 8 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Cc kcrisman added
  • Description modified (diff)
  • Priority changed from minor to critical
  • Status changed from new to needs_review
  • Summary changed from Maxima timeout when creating tab completion list on Mac Tiger to Maxima timeout on Mac OS X 10.4 (Tiger)

Changed 8 years ago by jdemeyer

comment:5 follow-up: Changed 8 years ago by kcrisman

How did this change from minor to critical? There is nothing wrong with tab completion on that platform AFAIR, just this timeout.

Are there any problems we might expect from this change, such as interrupts not working as quickly for Maxima on other (newer) platforms?

comment:6 in reply to: ↑ 5 ; follow-up: Changed 8 years ago by jdemeyer

Replying to kcrisman:

How did this change from minor to critical?

I think a patch which adds a new platform to the list of completely supported platforms warrants being "critical". But that's just my opinion.

There is nothing wrong with tab completion on that platform AFAIR, just this timeout.

That's why I changed the ticket title. I guess somebody discovered the timeout in maxima.py and somehow mistakenly assumed it was because of TAB completion. Or, in an earlier version there was a problem was TAB-completion on OS X 10.4 which is now fixed.

Are there any problems we might expect from this change, such as interrupts not working as quickly for Maxima on other (newer) platforms?

Assuming that interrupts in Maxima are implemented properly (admittedly, a big "if"), there should not be any change in existing behaviour. If the interrupt works properly, the changed timeout doesn't matter.

This patch does not change the interrupt behaviour of Maxima itself, it only changes how often Sage sends interrupts to Maxima. On OS X 10.4, Maxima can be interrupted, it is just slow, which makes Sage think that something is wrong.

comment:7 in reply to: ↑ 6 Changed 8 years ago by kcrisman

How did this change from minor to critical?

I think a patch which adds a new platform to the list of completely supported platforms warrants being "critical". But that's just my opinion.

There is nothing wrong with tab completion on that platform AFAIR, just this timeout.

That's why I changed the ticket title. I guess somebody discovered the timeout in maxima.py and somehow mistakenly assumed it was because of TAB completion. Or, in an earlier version there was a problem was TAB-completion on OS X 10.4 which is now fixed.

I see, the answer to both are the same. I should clarify: as far as I could determine when I filed this ticket, it was precisely the tab-completion doctest which caused the timeout, but not because tab-completion didn't work, it just didn't doctest well. Hence the minor and mention of tabs.

Are there any problems we might expect from this change, such as interrupts not working as quickly for Maxima on other (newer) platforms?

Assuming that interrupts in Maxima are implemented properly (admittedly, a big "if"), there should not be any change in existing behaviour. If the interrupt works properly, the changed timeout doesn't matter.

This patch does not change the interrupt behaviour of Maxima itself, it only changes how often Sage sends interrupts to Maxima. On OS X 10.4, Maxima can be interrupted, it is just slow, which makes Sage think that something is wrong.

Right.

I'll try this when I get a chance - which won't be immediately, still recovering from SD35.5 and an accident incurred during that time.

comment:8 follow-up: Changed 8 years ago by kcrisman

Dumb question: why the nested try/except instead of two excepts? Is one better than the other in this case?

Perhaps just uninformed question: In expect.py, we send 'quit;\n'+chr(3), but here you only send chr(3) (end of text character, says wikipedia). Does that matter? I'd think Maxima would like to hear quit, perhaps, but maybe it really just needs this special character to know to quit a computation.


sage -t  "devel/sage/sage/interfaces/maxima.py"             
         [241.5 s]
 
----------------------------------------------------------------------
All tests passed!
Total time for all tests: 242.5 seconds

So that is a good sign... first time I've had that in years!

comment:9 in reply to: ↑ 8 ; follow-up: Changed 8 years ago by jdemeyer

Replying to kcrisman:

Dumb question: why the nested try/except instead of two excepts? Is one better than the other in this case?

Perhaps just uninformed question: In expect.py, we send 'quit;\n'+chr(3), but here you only send chr(3) (end of text character, says wikipedia).

In maxima, "quit;" doesn't really do anything. You just get

(%i1) quit;
(%o1)                                quit

In don't understand why expect.py sends quit; when it needs to interrupt. Since it doesn't do anything in Maxima, I omitted it.

And chr(3) is CTRL-C, in other words: the interrupt character.

comment:10 in reply to: ↑ 9 ; follow-up: Changed 8 years ago by kcrisman

  • Reviewers set to Karl-Dieter Crisman

Perhaps just uninformed question: In expect.py, we send 'quit;\n'+chr(3), but here you only send chr(3) (end of text character, says wikipedia).

In don't understand why expect.py sends quit; when it needs to interrupt. Since it doesn't do anything in Maxima, I omitted it.

And chr(3) is CTRL-C, in other words: the interrupt character.

Great, and I found a few sites that document this to some extent. It seems that (historically) this was not universal. Anyway.

I haven't tried this on any other computers. How could I test this from the command line of Sage? Presumably with Ctrl-C... that seems to work properly, sometimes I even see the new code in the traceback if I do it at the right time :)

Is that enough for positive review?

comment:11 in reply to: ↑ 10 Changed 8 years ago by jdemeyer

Replying to kcrisman:

Is that enough for positive review?

I guess that's up to your judgement really.

As for testing it: try using Sage to call Maxima commands and then interrupt that. But it seems that's would you did, and you didn't manage to break anything. That's a good sign.

Of course, interrupts are always a bit playing with fire, so I wouldn't be very surprised if this patch broke something in a non-obvious way.

comment:12 Changed 8 years ago by kcrisman

  • Status changed from needs_review to positive_review

Well, I've tested it on Intel Mac as well and I get different errors but interrupting still seems to work. It's nontrivial to find things that I can interrupt fast enough!

There was one weird thing that happened when I repeatedly interrupted and/or let finish the computation

sage: y = function('y', x)
sage: desolve(sqrt(y)*diff(y,x)+e^(y)+cos(x)-sin(x+y)==0,y,contrib_ode=True)

from the documentation. This is not tested, because it just raises an error (Maxima can't solve it), but in one session I was able to really confuse ECL and kept getting an unbound INFLAG error. But then I tried to get this again in the next session and, try as I might, I couldn't get it.

So I think this is at least as robust as our previous one. Or one could compromise with three interrupts and not infinitely many :)

So let's say positive review.


Incidentally, you might find this amusing.

sage: maxima.eval('factorial(100000)')
'282422940796034787429342157802453551847749492609122485057891808654297...
sage: maxima.eval('factorial(100001)')
'100001!'

comment:13 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-4.8 to sage-5.0

comment:14 Changed 8 years ago by jdemeyer

  • Merged in set to sage-5.0.beta0
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.