rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

Multiple comparisons can cause stack overflow #3575

Open rtoy opened 3 months ago

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-08 09:30:00 Created by peterpall on 2014-12-05 04:47:04 Original: https://sourceforge.net/p/maxima/bugs/2851


There have been many places where an if caused the facts database to overflow and that have been fixed. Seems like one of them is still left:

Seems like a bind stack overflow pops up at least once a year in the maxima mailing list and all of the times the maxima is running using gcl. Which might be caused by the fact, though, that the windows installer and the debian package (which is also used on ubuntu) are using gcl.

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-08 09:30:01 Created by robert_dodier on 2022-11-03 16:58:05 Original: https://sourceforge.net/p/maxima/bugs/2851/#dd02


rtoy commented 3 months ago

Imported from SourceForge on 2024-07-08 09:30:05 Created by robert_dodier on 2022-11-03 16:58:05 Original: https://sourceforge.net/p/maxima/bugs/2851/#e426


I looked at a similar problem and it looks like the results of comparisons are cached in the assume database, and when there are a lot of comparisons, it quickly blows up. We should look at whether it's necessary to do that caching.

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-08 09:30:08 Created by peterpall on 2023-04-30 06:40:54 Original: https://sourceforge.net/p/maxima/bugs/2851/#e426/b533


many comparisons are fast. The assume database quickly grows slow if we ca he many comparisons in it. It doesn't make sense to cache stuff that is fast and showtime shows that we have a timer => could we trigger saving something to that cache only if a comparison requires more than 0.1 seconds or similar?

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-08 09:30:12 Created by macrakis on 2023-05-01 16:40:41 Original: https://sourceforge.net/p/maxima/bugs/2851/#dc84


This has to do with compar, not with if. Reproduced with smaller constants:

assume(x > 100);
for i thru 1000000 do
    sign(x*random(100)/(random(100)+1)+random(100)-x-50);

INFO: Binding stack guard page unprotected

How long it takes to fail varies quite a lot.

Maxima 5.46.0 SBCL 2.3.0 MacOS

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-08 09:30:16 Created by macrakis on 2023-05-01 16:42:22 Original: https://sourceforge.net/p/maxima/bugs/2851/#344b