View Single Post
Why hello there,

Although I intend to submit a bug report via e-mail to Omni as they've requested, I thought it would be helpful for people to read about my own experiences that took place this morning, and how I worked to identify (and fix) the problem.

I woke up to find that my OmniFocus across my iPhone, iMac and MacBook Air was horribly corrupted since I left it last night. You can imagine that this was very upsetting, especially after having completed some monumental project-planning. The problem manifested itself differently on each device:
  • iMac: Random projects and action groups were missing names
  • iMac: Random projects and action groups appeared in my inbox
  • iMac: Missing projects and action groups
  • MacBook Air: Missing projects and action groups
  • iPhone: Missing projects and action groups
After the initial shock of seeing all devices corrupted, I began to plan my attack on the problem. I have the following setup:
  • iMac MacOS Lion 10.7.3: Primary machine. OF vers 1.9.4
  • MacBook Air MacOS Lion 10.7.3: OF vers 1.9.4. Syncs from iMac
  • iPhone iOS 5.0.1: OF vers 1.13.3. Syncs from iMac
It was still before 10am PST, and therefore too early to call Omni. Besides, I preferred not to send anyone my OF database.

My first attempt was to revert back to my most recent version of the database in the Backups directory. I tried this on both my iMac and my MacBook Air, but I still saw the same problem.

It had occurred to me that a last-minute OF edit on my iPhone last night might have caused the problem, but I dismissed the idea as the manifestation was too profound. As a sanity check, I also confirmed that OF wasn't in "focus" mode.

At that point, the only step was to try revert to an earlier backup. I imported the previous backup, and it worked! Unfortunately, the previous backup took place four hours earlier, and in those four hours I had made many changes. In addition, I was still uncomfortable about the fact that I did not know what happened.

Nonetheless, I was very pleased that, at worst, I would need to re-do four hours of planning. However, I had lost a huge amount of trust in OmniFocus and felt that I needed to better understand the problem as a way to rebuild that trust. After all, I've been using it non-stop for six months without a single problem, and I am hugely dependent upon it.

After a little research online, I discovered that I can open up the database by changing the extension of the file from .ofocus-backup to .xml. In this way, the file changes into a folder containing a bunch of zip files, each of which themselves contain a xml file. After suddenly thinking that I could read each of the 500 xml files and simply re-structure my project from scratch, I quickly realised that each xml file represented a change-set, instead of a project node.

I did actually contemplate parsing through each xml and re-building my projects manually, effectively re-running my decisions last night in slow motion, but, thankfully, I decided to have a bowl of cereal first! Over this bowl, I was struck by a better idea. That is, to reconstruct a new, hybrid ofocus-backup file by gradually adding change-sets from the newer corrupt database to the older non-corrupt database.

If I was fairly easily able to convert between .ofocus-backup and .xml versions of the database, I could hone in on the change-set that caused the corruption in the first place through a form of binary search. To begin, of the 500 changes that took place between the two most recent backups, I copied across the first 250 changes. It worked! I saw a non-corrupt version of my OF with half of my changes. I was startled.

From that point on, it was easy. I continued to add half-size groups of changes until I had around 10 changes remaining. As I originally suspected, the problem change-set was among the last few; it had to have been, because I saw no problems last night. Finally, I found the problem-causing change-set three before the end. The xml is:

Code:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<omnifocus xmlns="http://www.omnigroup.com/namespace/OmniFocus/v1"
app-id="com.omnigroup.OmniFocus" 
app-version="77.86.0.157059" 
os-name="NSMACHOperatingSystem" 
os-version="10.7.3" 
machine-model="MacBookAir3,1">
<folder id="ffm62XkZ7r8" op="delete"/>
    [MANY FOLDER DELETES]
<task id="opxWeVcHLHu" op="delete"/>
    [MANY TASK DELETES]
</omnifocus>
While it seems that this xml is not itself corrupt, a clue lies in the machine-model. Just before closing up last night, I decided to create a new sync connection between my MacBook Air and my iMac. And, for some reason, that caused the MacBook Air to send a whole bunch of deletes to the iMac, thereby giving the appearance that the database had been corrupted. Besides creating a new sync connection, I took no further action on the MacBook Air last night and so those random deletes should not have happened.

And that's it! I am back to being a (mostly) happy Omni user again. I have recovered all my changes from last night, and I have a better sense of what happened so that I can avoid it / look out for it in future.

I am happy to answer any further questions about it.

Regards,
Bekhor