Issue 100230

Summary: formulas missing when file reopened 'cause MacOS automatically cleans tmp folder
Product: Writer Reporter: lhorner <lhorner>
Component: editingAssignee: AOO issues mailing list <issues>
Status: UNCONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: fninh123, issues, michael.ruess, mikhail.voytenko
Version: OOO310m5   
Target Milestone: ---   
Hardware: Mac   
OS: Mac OS X, all   
Issue Type: ENHANCEMENT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
mangled file
none
Formula Objects Dissapear none

Description lhorner 2009-03-16 12:57:21 UTC
Irregularly, I open an Openoffice.org writer file and find that all (or sometimes almost all) of my equations 
have been replaced by red icons labelled object #.  This morning it happened again.  OOo had not crashed.  
There was not recovery dialog.  I closed (the file didn't even ask if I wanted to save) and quit and restarted 
to no avail.  Given than I'm writing physics exam solutions, this is a major downer - an hour or so of saved 
work up in smoke.  

I'll attach an example of the destruction.
Comment 1 lhorner 2009-03-16 12:57:59 UTC
Created attachment 60946 [details]
mangled file
Comment 2 michael.ruess 2009-03-16 15:35:29 UTC
MRU->MAV: we have now two similar cases (this and issue 97207), where formula
objects are lost upon saving a document. Both happen on Mac and in both cases
the "ObjectsXX" folders are missing in the file format. Can you imagine how this
could happen?

MRU->lhorner: what setting do you have in
"OpenOffice.Preferences.OpenOffice.Memory" for OLE objects?
Comment 3 mikhail.voytenko 2009-03-16 16:54:18 UTC
The first idea I have is the known feature of MacOS to clean the temporary files
folder. It affects the embedded objects at first place.

mav->lhorner: Please try as a workaround to set the temporary folder to a
different location that is not affected by the removing process. If I am right
with my assumption it should help. The temporary folder can be changed using
"OpenOffice->Preferences->OpenOffice.org->Paths" on MacOS.
Comment 4 lhorner 2009-03-16 17:41:33 UTC
"lhorner: what setting do you have in
"OpenOffice.Preferences.OpenOffice.Memory" for OLE objects?"
cache for inserted objects - number of objects 40 

The only place to set amount is with graphical objects:
80MB
2MB / object
remove after 5min

I have reset the temp folder to something in my document folder.  I will re-upgrade to m5 and see if it 
happens again.  (I downgraded to 3.0.1 because I thought I remembered this happening in the past 
with bleeding edge and not with stable releases.)
Comment 5 lhorner 2009-03-28 00:48:47 UTC
I'm still in 3.0.1 (300m15).  As noted, I had moved my temp files.  I opened a file just now and it told 
me the file was locked by another user (me - not really).  I let it open as read only and the equations 
are gone again.  

I quit OOo. In terminal I renamed .~lock.HW9_solns.odt# in the directory of my file.  I restarted OOo 
and had it open the file again.  This time, no lock complaint, but still all the equations and figures are 
gone.

There is only 1 empty folder in the moved temp directory although the directory modification time 
suggests it still being used.

This time as well, OOo has not crashed nor have I force-quit it since I last edited this file (this 
morning).

Suggestions for how to avoid future trouble?

I'll attach the file fwiw.
Comment 6 mikhail.voytenko 2009-03-30 13:28:25 UTC
I assume that the reason, why the file is locked by you is that there is a lock
file from another office installation ( OOo3.1 ).

If I am correct with my assumption regarding the temporary folder, then the
embedded objects are lost on saving, not on loading. That means that in this
case you have just opened an already broken document. Of course the "temporary
folder move" workaround can not help in this case.

Please correct me if I have misunderstood your comment.
Comment 7 lhorner 2009-03-30 15:11:33 UTC
It seems reasonable that the links are lost on closing.  That leaves two questions:  why is the file getting 
mangled on saving and why isn't OO realizing the problem as it saves rather than when it finds the lock 
some time later?
Comment 8 mikhail.voytenko 2009-03-30 15:57:05 UTC
My assumption is that the file is broken during the saving because the temporary
files were removed. As result some contents were lost. The remaining lock-file
looks like a result of crash, that would explain why the OOo3.1 did not try to
repair the document. Usually, if saving fails, the repairing is done.

Please try to find the user layer of OOo3.1 you have used. There should be
backups of stored document in the backup folder, the backup contains the
document name as the prefix. That could probably help to get the lost
information back, although the backup contains only the version before the last
save.

Please let me know if you are able to generate such a broken document while
having the temporary folder moved.
Comment 9 lhorner 2009-04-05 15:28:12 UTC
Thanks for telling me where to find the back-up files manually.  I would, of course, prefer for OOo to use 
them itself, but it is good to know a fall-back mechanism.  There were a handful of files in the at folder - 
ending with 0 or 00 in the file name.   I opened them.  Several asked for character-set information.  One 
said it was locked.  All were free of the dread red missing object icon.

As to whether I can generate a broken document with the temp file moved, the results are some what 
mixed.  The last time one was generated spontaneously (reported above) was with the temp file moved.  
However, I just tried having a document open and running the OSX cleaning routines from terminal and 
failed to break the file then.  
Comment 10 michael.ruess 2009-04-06 12:10:22 UTC
OOo does not recognize, when MacOS cleans up the tmp folder though its contained
files are still in use. Maybe a warning for the user should be given to the user
to use the backup files or anything else.
Comment 11 mikhail.voytenko 2009-04-14 08:05:36 UTC
mav-lhorner: Ok, that means the the moving of the temporary files is no
workaround actually if I understood your last comment correctly. By the way
removing of the temporary files does not always affect the edited documents, so
it is not a surprise that a just opened file was not corrupted.

Please try to edit about 30 embedded objects and start the cleaning routine
then. I assume that this should allow to reproduce the problem.
Comment 12 lhorner 2009-04-17 03:16:29 UTC
The latest frustration.

I closed all my documents (saving any that asked) and quit OOo.  I shut down the computer.  I restarted 
the computer at home and opened a pair of documents that my OS decided to open with OOo.  I 
noticed that OOo was acting as though it had crashed - offering to recover documents.  I let it.  It 
opened them - and I proceeded to close all the extra junk.  The first file I closed asked me if I wanted 
to save changes.  Stupidly, I said yes.  It closed.  I reopened it, wondering whether my last edits had 
been lost in the crash that didn't happen.  To my horror the entire file opened without any equations in 
it.  So I went to ~/Library/Application Support/OpenOffice.org/3/user/backup expecting to find the file 
there.  It is not there.  Nothing is there more recent than March 27.  

Temporary files path is set to ~/Documents/OOoTemp.  Fortunately, the file was saved there correctly 
so I have not had to reconstruct all my equations this time.  

I opened a file with a lot of equations in it.  Started all three cleaning tasks and then while they were 
running added equations to my file and fiddled around with it.  I did not think to close it while the 
cleaning tasks were on.  At any rate, when I did close and re-open it, nothing bad happened. 
Comment 13 mikhail.voytenko 2009-04-17 05:51:55 UTC
mav->lhorner: I understand that it is very frustrating to fail a document,
especially if much time was invested in it. There is no backup because the
saving process was successful I assume. The backup remains in backup folder in
two cases:
 - saving was unsuccessful, the target document was corrupted and could not be
repaired
 - saving was successful, but there is an explicit request to create backup on
saving
The backup creation on saving can be requested using
Tools/Options/"Load/Save"/Save/"Always create backup copy" checkbox. I hope it
will allow to prevent document loss in future.

In this case I assume that the saving was successful, the objects were probably
lost on crash-handling. I can not currently understand why did office try to
repair documents that was successfully stored and closed, may be the office has
crashed while storing one of the documents. That would explain why is the
preserved version is incomplete. The problems described by you in issue 100271
might have the same roots, since it also looks like a crash during
storing/exporting.

Sorry, it is hard currently to say what goes wrong here without possibility to
debug the scenario.
Comment 14 lhorner 2009-04-17 12:40:22 UTC
"Sorry, it is hard currently to say what goes wrong here without possibility to
debug the scenario."  
If you can tell me how to get debug information to you, I'll be happy to try.  

Note that on crash recovery when the instructions say that clicking the "next" button will take me to 
the debugging tool, all that ever happens is that the dialog box disappears and my documents are 
available.  I assumed that crash info was being sent without my aid, but perhaps the debug tool is also 
failing.  

"The problems described by you in issue 100271
might have the same roots, since it also looks like a crash during
storing/exporting."
That seems unlikely to me.  Issue 100271 arises from specific characters being typed into equations 
and only occurs when attempting to create a pdf file - not on saving normally.

The issue here is that OOo is losing its mind without crashing so none of the protect-data-on-
crashing mechanisms are coming into play.  Note that the data was actually still in the temporary 
folder.  That suggests to me some failure of communication among the temporary folder, the real 
folder, and the backup folder.
Comment 15 mikhail.voytenko 2009-04-17 13:06:30 UTC
mav->lhorner: In your last comment you have written "I noticed that OOo was
acting as though it had crashed - offering to recover documents." That let me
think that there was a probability of crash during the last saving, that would
also explain why the objects are lost. That would of course differ from the
original problem you have mentioned in the issue, but my lst comment has
addressed the last "frustration" comment from you. 

As for the debug info, first of all a reproducible scenario is necessary. Is
there a scenario that would let the problem be reproduced for sure at least on
your system?
Comment 16 ccheney 2010-05-21 15:12:05 UTC
This appears to also be happening on Ubuntu 10.04 with OOo 3.2.0 with ooo-build
patches.

https://launchpad.net/bugs/501030
Comment 17 fninh123 2011-03-18 23:41:42 UTC
I am using OpenOffce 3.3.0 OOO330m20 on MacOS 10.5.8. In the past week formula objects have dissappeared after saving and re-opening the next day. I will include my document as an attachment "ME 348 Project".

I had this problem once before I updated Openoffice to 3.3.0. I don't remember the version I used before.

I did find a backup file and appreciate the suggestion from mav.
Comment 18 fninh123 2011-03-18 23:43:40 UTC
Created attachment 76147 [details]
Formula Objects Dissapear

Another occurance of formulas missing/dissappearing after saving.