fdo 37341 MAXRECURSION reached in ScFormulaCell::Interpret

Eike Rathke erack at redhat.com
Thu Jul 11 03:43:53 PDT 2013


Hi Winfried,

On Thursday, 2013-07-11 08:02:13 +0200, Winfried Donkers wrote:

> Presently I'm looking at bug fdo 37341, which reports calc to hang when Goal Seek (sc/source/core/tool/interpr2.cxx, ScInterpreter::ScBackSolver()) is used.
> The cause of the problem is not that too many iterations are needed, but that MAXRECURSION in sc/source/core/data/formulacell.cxx, ScFormulaCell::Interpret() is reached.
> Increasing MAXRECURSION 'solves' the problem.

It may cure the symptom in this specific case, but does not solve the problem.

> I think increasing MAXRECURSION from its present value (400) to 800 is
> no problem. 10 years ago its value was 500 and in the past 1 years the
> available memory has been more than doubled.

You're misreading history ;-)

The past value can't be compared as the entire mechanism how recursions
are handled has changed. The previous 500 was that if there were more
than 500 recursions the entire calculation chain set an error at the
formula cells involved.

The new mechanism first attempts a recursion up to MAXRECURSION and if
it reaches the limit it unwinds the stack, remembers formula cells
involved and continues from the point it left to find the end of the
recursion and start calculation from that side. Increasing MAXRECURSION
would set the threshhold higher at the cost that if it is reached more
time would be wasted in calculating the recursion before detecting that
threshhold.

> Shouldn't a global error (or at least warning)  be generated when
> MAXRECURSION is reached? After all, the result of
> ScFormulaCell::Interpret() is not correct in that case.

I presume it is the combination of BackSolver iteration and recursion.
Setting an error if MAXRECURSION is reached is not appropriate.

> Unfortunately, I can't quite grasp the recursion/interation process in
> ScFormulaCell::Interpret(), so I can't generate the appropiate error.

That thing is a beast and time consuming to debug. To understand what it
does it would help to set MAXRECURSION to 5 or so and have a few more
simple recursing formula cells to step through. (A9:=A8 A8:=A7 ...)

Setting up a simple BackSolver scenario that kicks in badly with the
reduced limit might be equally challenging..

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key ID: 0x65632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
For key transition see http://erack.de/key-transition-2013-01-10.txt.asc
Support the FSFE, care about Free Software! https://fsfe.org/support/?erack
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20130711/ad45f30a/attachment.pgp>


More information about the LibreOffice mailing list