Wednesday, August 17, 2011

Adventures with OSX Lion. Addressbook goes funky!

Yesterday I applied the Lion 10.7.1 Update. Yes - it is available and fixes some Wi-Fi and video issues.  After applying the update my Addressbook appeared to have problems.

I have about 5,500 entries in my Addressbook and I have been through multiple clean ups to remove duplicates as a result of merges from Google, Plaxo and MobileMe. Duplicates have been nothing new. They have been happening for years. But this funkiness was different.

The two pane Faux-Leather Addressbook view would not update correctly. Three things happened:

1. Filtering in the search bar failed to work against all contacts. It would work for a group.
2. Search also failed. 
3. In the 2 pane view selecting a contact in the list on the left failed to update the view on the right. It stayed showing whichever record had been displayed first when Addressbook opened.

In another wrinkle, you could quit or Force Quit from Addressbook and reopen the application and you may be able to click on different contacts and have the record update in the right hand view pane. However, this would then stop after about 45 seconds and the right pane was frozen on whichever record was last displayed.

Fortunately, because I have had so many situations where syncing has doubled up on records I have developed a habit of taking frequent exports of the Addressbook. Just go to File....Export....Address Book Archive. This will take a snapshot of your entire addressbook.

I am regularly adding to my Addressbook as I meet new contacts. So new records are added almost daily.

A trip to the Apple Store in Towson led to my machine having the OS re-installed. The secret partition that is installed with OSX Lion proved it's worth! Before that I worked with the Geniuses at the store to create a new test account and copy the addressbook across to the new account. The same problem appeared. They copied it to another machine and there wasn't a problem. Interesting!

The re-install put the machine back to 10.7.0. But still the problem persisted. At this point the Genii were flumoxed! So I took the machine home where I would have access to Time Machine if I needed to restore. The challenge was on! Could I get to the bottom of the problem.

Google Sync, Adium Integration, Skype links to the addressbook, and MobileMe Sync had all been disabled to reduce the number of error vectors.

Experiments revealed that if I chose a group or distribution list first the filtering and search and right pane view all worked. So I selected all of the records in my addressbook and created a new group using File...New Group From Selection. This new group still had the problem.  This pointed to a problem with the records in the Addressbook.

The next step was to load up Textmate and take a look at the Addressbook archive. Unfortunately it is not a single file. The Archive comprises:

- AddressBook-v22.abcddb
- Configuration.plist
- Images Folder
- MailRecents-v4.abcdmr
- Metadata folder

The Images folder contains documents or .jpeg files where the filename is in the format:

This corresponds with a file in the Metadata folder where the filename is in the format:

It would be no easy task to isolate which files had been corrupted but this is what was the most likely scenario. So, I went to a backup from a couple of days prior and restored the Addressbook Archive.

After a couple of minutes the data in Addressbook had been replaced. To be safe I quit Addressbook and restarted.  Everything worked! I was just short about 30 records. I switched MobileMe Sync back on in the preferences and after a sync I was back very close to the most recent number of records. 

Apple, If you are listening. It would be great to have a view in Addressbook that could list records in Record Number sequence. This would allow you to easily identify the latest records added. And NO! Show Last Import doesn't cut it.

One quick trick to quickly check how many records you have is to enter "*" in the search bar of Addressbook. It returns a record count.

The only way to get at records in Addressbook in Record number sequence is to write an Applescript that will do a For Next Loop through the database. it's clumsy but it will work.

The answer to the problem does indeed appear to be a glitch in creating a recent addressbook record. 


The lessons learned are:

1. Take frequent backups. I have TimeMachine but I had problems with Addressbook crashing when quitting from Time Machine in Addressbook. Presumably because of the record corruption in the Addressbook database. I will probably write a script that will be run as a Cron job to keep a rolling three generations of Addressbook Archive.

2. MobileMe is a help (to be superceded by iCloud) it is great to have a backup of your addressbook that is in the cloud and available to your iPhone/iPad etc.

3. The OSX update didn't mention anything about changes to Addressbook, but I will be careful in applying the 10.7.1 update.

So now I am back to a working Addressbook but I am still on 10.7.0. Next step is to re-apply the 10.7.1 update and see if Addressbook still works. Before I do that I am off to export my addressbook as an archive. You can't be too careful!

Posted via email from More pre-blogspot than pre-posterous