Issue 76554 - Error saving calc document when Windows heap is low
Summary: Error saving calc document when Windows heap is low
Status: CONFIRMED
Alias: None
Product: Calc
Classification: Application
Component: save-export (show other issues)
Version: OOo 2.2
Hardware: PC Windows XP
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-20 17:19 UTC by mikeverstegen
Modified: 2017-05-20 11:13 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description mikeverstegen 2007-04-20 17:19:38 UTC
A classic Windows problem is to be low on heap space. Programs fail in various
ways when the (system wide) heap is near exhaustion. I monitor my heap
availability with a shell script to prevent exhaust and have noticed a
correlation between low heap available and an error saving files in
OpenOffice.org calc. 

After exceeding approximately 92% heap used and then trying to save a Calc file,
I get the error message "Error saving the document MLS-6.ods: Write Error. The
file could not be written."

When heap usage is decreased, the file still cannot be saved. The only way that
I have found to recover at this point is to copy the entire worksheet and paste
it into a new blank worksheet.

I also observed the behavior in OOo 2.0 and OOo 2.1.

Useful Links and information about Windows heap space:
•	Windows heap monitor tool
http://www.microsoft.com/downloads/details.aspx?FamilyID=5cfc9b74-97aa-4510-b4b9-b2dc98c8ed8b&DisplayLang=en
•	To install it, you need a symbol file as described here:
http://support.microsoft.com/kb/914216
•	The driver must be loaded before first use – dheapmon –l  (shouldn’t it do
this automatically??)
•	Finally run from the command line -- dheapmon
Comment 1 kpalagin 2007-05-28 21:13:37 UTC
mikeverstegen,
what would be a reproducible way to exhaust heap?
Comment 2 mikeverstegen 2007-05-28 21:38:57 UTC
Windows heap is consumed by a appliations in varying amounts. I have a (bad?)
habit of keeping quite a few appliations active..

By watching the heap monitor (see below) I can see heap increasing. The
applications which seem to use big chunks of heap are:
- Windows (File) Explorer -- particularly with multiple instances open. A big
chunk of heap is released after the last Explorer is closed
- Outlook 2003
- Intuit products - Quicken and QuickBooks Pro
- Adobe products - Photoshop Elements (3.0) and Premier Elements (1.0)

I use the following (cygwin) bash script to use dheapmon.exe (described in the
first comment) to periodically monitor the heap usage

HEAPCMD=/cygdrive/c/kktools/dheapmon8.1/x86/dheapmon.exe
$HEAPCMD -l
while true
do
	HEAPUSED=`$HEAPCMD | grep "WinSta0.*Default" | cut -c 55-56`
	if [ $HEAPUSED -gt 92 ]; then
		echo -e `date` "\007Heap limit exceeded" $HEAPUSED
		sleep 10
	else
		echo `date` " Heap OK" $HEAPUSED
		sleep 30
	fi
done
Comment 3 mikeverstegen 2007-06-03 15:41:36 UTC
Additional Information from original submitter:

Today, I tried to save the calc file and experienced the same problem as noted
in the original submission. I noticed that the heap usage was (what I consider)
OK at 85 (out of 100) when I clicekd the Save icon. I had previously only noted
this problem occuring at heap usage of 93.

I noticed that in the directory E:\Documents and Settings\username\Application
Data\OpenOffice.org2\user\backup that there were two zero length files named
MLS-10.ods_0.ods and MLS-10.ods_1.ods which are similar to the "MLS-10.ods" file
I was trying to save. (I see similarly named files all the way back to MLS-1.ods
when this problem started.)

I don't know if this is relevant, but I have Save AutoRecovery information every
... set to 5 minutes. I have had high heap usage that exceed 5 minutes, so
perhaps the AutoRecovery Save was triggered during high heap usage periods.

Are there any error logs created that I should capture/report to assist in
documenting this problem?
Comment 4 frank 2007-07-23 14:48:05 UTC
Hi Niklas,

please have a look at this one.

Frank
Comment 5 mikeverstegen 2007-09-11 00:57:54 UTC
Note that I have upgraded to 2.2.1 since the original bug report.

I've now seen this problem exhibit with OO.o Writer saving a very small document
less than one page long. The file had been open for several days. When trying to
save, I recieved the same message as noted for the Calc save error. Heap use is
hovering between 90 and 95.

Similar to with Calc, I found two zero length files in E:\Documents and
Settings\Mike\Application Data\OpenOffice.org2\user\backup named
filename.odt_1.odt and filename.odt_2.odt with the time stamps of when I tried
to save the file.

Only solution I found was to copy the entire document to a new blank document
and save over the existing name.
Comment 6 frank 2007-09-11 09:07:43 UTC
@mike

please don't change the version field after submitting an Issue. This field
defines the first occurrence of a problem and is therefore a vital information.
If you want to let us know that it is still in an other version just comment on
the Issue.

Frank
Comment 7 mikeverstegen 2007-09-24 17:14:46 UTC
I have upgraded to OOo version 2.3 and am still experiencing this problem in
both  Calc and Writer. 

Is there a debug or trace option / version that I can run to capture more
details to assist in troubleshooting?
Comment 8 mikeverstegen 2007-10-05 17:02:25 UTC
OOo calc 2.3 (and Writer -- see last paragraph)

This problem continues and I'd like to provide new informaiton. Previously, when
the file save error occured, I could 
- dismiss the error message dialog box
- select the entire spreadsheet and then Edit / Cut
- File / New create a new blank spreadsheet
- Edit / Paste the old spreadsheet into the new blank spreadsheet
- Only have to manually reapply the Window / Split

The last two times this error has occurred, the two graphs in the spreadsheet
have not copied over completely. The outline and axes of the graphs are copied,
but the data is not displayed.

The most recent time that I tried to save, I received a different error message
when I tried to save
"Microsoft Visual C++ Runtime Library"
"Runtime Error!"
"Program E:\Program Files\OpenOffice.org2.3\programs\soffice.bin"
"abnormal program termination"
...and all OOo applications running at that time closed.

When I restarted OOo, the recovery window showed both the original file and the
untitled spreadsheet to which I had pasted the copy. I could save BOTH copies --
not in particular that the file that was previously unsavable could now be saved.

At the point that this error occurred, plenty of free heap space was available,
but there have been excursions of heap usage past 93% since the last reboot.

Note also that while trying to save all my files after the first error pop-up --
the application level "can't save" dialog -- (not the second C++ runtime popup)
an open Writer file also would not save and I had to cut and paste it in to a
new document also.
Comment 9 mikeverstegen 2007-10-26 17:25:29 UTC
This error continues to occur. Additional information from today's event:

Same "Error Saving..." dialog box. Cut and Paste to new blank calc sheet. Try to
save new spreadsheet (with old sheet still open). Calc crashes. Allowed
automatically generated crash report sent to Sun (reference this issue number in
the comments).

When Calc auto-restarted after crash, the old file was recovered (missing the
last few edits) and the new spreadsheet was blank (lost the data pasted in).

This is the interesting part -- the auto-recovered OLD sheet could now be saved
successfully.
Comment 10 Marcus 2017-05-20 11:13:11 UTC
Reset assigne to the default "issues@openoffice.apache.org".