Issue 20986 - Iterative calculation freezes Calc
Summary: Iterative calculation freezes Calc
Status: CLOSED FIXED
Alias: None
Product: Calc
Classification: Application
Component: code (show other issues)
Version: OOo 1.1 RC4
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: oc
QA Contact: issues@sc
URL: http://www.rpgd.uklinux.net/RO_model.sxc
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-10 03:02 UTC by bgprior
Modified: 2013-08-07 15:15 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Spreadsheet with iterative calculations that crash OOo 1.1RC3 (44.51 KB, application/octet-stream)
2003-10-10 03:05 UTC, bgprior
no flags Details
Simplified version of original attachment (RO_model.sxc) (36.88 KB, application/octet-stream)
2003-11-10 15:13 UTC, bgprior
no flags Details
For the curious: dependency graph of formulas, stripped down to the essentials. (237.38 KB, image/png)
2004-12-06 19:21 UTC, ooo
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description bgprior 2003-10-10 03:02:39 UTC
I am in the process of creating a complex spreadsheet to model the effect of UK
government policy to encourage renewable energy development. The incomplete
spreadsheet can be downloaded from the given URL. Don't try to make too much
sense of it - it's at an early stage and may well be badly flawed as well as
incomplete.

The policy is recursive (i.e. the amount of renewables expected to be delivered
has an effect on the forward price, which determines how much will be built,
which again affects the price). Consequently, I need to use iterative calculations.

When I create the first formula with an iterative reference (it actually sets up
a complex chain of references), several of the cells give a 522 error, as they
should with iterations turned off in the settings. However, enabling iterations
reliably crashes OpenOffice. It simply freezes, taking up a very large
proportion of CPU time. There is no sign of a progress bar (which I assume
should show up at the bottom of the window) showing something happening in the
background. I have left it a good long time (several minutes), in case it is
simply chewing over the calculations without indicating progress. I have tried
changing the iteration settings before opening the spreadsheet, to reduce the
max number of iterations (as low as 10) and increase the minimum change (as high
as 1). None of this helps. As soon as I turn on iterations or open the
spreadsheet when they are enabled, OpenOffice freezes.

I have saved the spreadsheet in XLS format and opened it in Excel. Excel happily
performs the iterative calculations (they bounce wildly, rather than settling,
but that is actually in accordance with what one would expect given the policy -
I will probably need to add some artificial dampening to get it to move towards
a median position). As far as I can tell, this spreadsheet works OK in Excel, so
it seems to be a problem with OpenOffice's handling of iterative calculations.

Cheers,

Bruno
Comment 1 bgprior 2003-10-10 03:05:45 UTC
Created attachment 10165 [details]
Spreadsheet with iterative calculations that crash OOo 1.1RC3
Comment 2 frank 2003-10-10 11:56:53 UTC
Hi Eike,

it seems to be yours. CPU load is around 99% and memory consumption is
jumping up and down about 200 kB. Loop ?

Frank
Comment 3 bgprior 2003-10-10 14:46:38 UTC
I have now upgraded to Mandrake's OpenOffice.org 1.1-0.rc4-2mdk
packages. I understand this is pretty close to 1.1 RC5/final. The
problem is still present with this version.

Bruno
Comment 4 ooo 2003-11-10 14:14:56 UTC
Bruno,

Any chance to narrow down the document to something being more
debugable (read: much less data and formulas) and still have the loop
reproducible? Otherwise this is going to be a nightmare..
Comment 5 bgprior 2003-11-10 14:55:28 UTC
One way or another, I guess this is going to be trial and error. I'll
see what I can do, but I'm not sure what's causing the problem, so
which bits I can cut out and still retain the behaviour.
Comment 6 bgprior 2003-11-10 15:12:19 UTC
Well, the file size isn't much smaller, but I've cut out all but the
first four years on the second sheet, and any other redundant rows I
could find. I'll attach it as RO_model2.sxc.

This is the easy bit. I could probably go a little further and cut
another year or two (but I had probably better leave at least two).
But narrowing it down beyond that will take rather more work. Does
this help, or do I need to go further?
Comment 7 bgprior 2003-11-10 15:13:36 UTC
Created attachment 11111 [details]
Simplified version of original attachment (RO_model.sxc)
Comment 8 bgprior 2003-11-10 15:14:27 UTC
By the way, I checked, and RO_model2 still crashes OOo when iterations
are enabled, but calculates fine in Excel.
Comment 9 ooo 2004-11-09 10:50:21 UTC
I never got a crash, but Calc freezes reproducible, adjusting summary.
Comment 10 ooo 2004-12-06 19:21:02 UTC
Created attachment 20182 [details]
For the curious: dependency graph of formulas, stripped down to the essentials.
Comment 11 frank 2004-12-07 09:24:46 UTC
*** Issue 38549 has been marked as a duplicate of this issue. ***
Comment 12 boris_stitnicky 2004-12-07 10:35:08 UTC
HI EVERYONE, Frank has just told me that my issue (38549) was a duplicate of
this one. It's pretty close, but not exactly a duplicate. My humble plea boils
down to: (1) please add the option of turning off the convergence guardian
(error 523) and (2) please increase the maximum allowed setting for iterations
to somwhere around 10E9 (yeah, there are people thinking about spreadsheets on
supercomputers - sorry for that, I am a biologist, not a programmer).

TO TAKE THIS ISSUE A LITTLE BIT FURTHER, if the convergence guardian is turned
off, then it naturally happens to you during the work that whole your complex
calculation network crashes (at least in Microsoft Excel) or goes astray and
that's why all my formulas have to start with checking if the input cells have
sane values or not, which I hate.

I PROPOSE THAT besides FORMULA and VALUE, each cell should have one more
property, RESET VALUE, which is pasted onto VALUE when your calculation network
goes astray (reset invoked upon user command or even automatically). I have to
implement reset system this manually in all formulas of my calculation networks
and it tends to double the size of my file and slow down the calculation. I
think the option to reset certain cells with a given cell-specific user-defined
value should be built in the application, but never dared to bug MS about this.
Comment 13 ooo 2004-12-07 11:27:38 UTC
boris_stitnicky,

Please, this issue is about a specific problem. Don't mix it with feature
requests or requests for enhancement, which are handled differently. I reopened
issue 38549 for that reason.

Thanks
Eike
Comment 14 ooo 2005-02-18 18:56:29 UTC
On branch cws_src680_calcer:
sc/inc/cell.hxx 1.16.30.2
sc/inc/document.hxx 1.84.8.1
sc/inc/recursionhelper.hxx 1.1.2.1
sc/source/core/data/cell.cxx 1.25.28.1
sc/source/core/data/documen2.cxx 1.46.8.1
sc/source/core/tool/interpr4.cxx 1.31.52.2
Comment 15 ooo 2005-02-22 10:46:15 UTC
Additional files:
sc/source/core/data/cell.cxx 1.25.28.2
sc/source/core/data/documen7.cxx 1.7.222.1
sc/source/core/tool/cellform.cxx 1.2.290.1

Ready for QA.


re-open issue and try to reassign to oc@openoffice.org
Comment 16 ooo 2005-02-22 10:46:22 UTC
try to reassign to oc@openoffice.org
Comment 17 ooo 2005-02-22 10:46:26 UTC
try to reset resolution to FIXED
Comment 18 oc 2005-02-24 12:02:53 UTC
verified in internal build cws_calcer
Comment 19 oc 2005-03-18 11:17:56 UTC
closed because fix available in OOo1.9m87