Preview hangs while viewing images / PDFs files within mounted sparsebundle

hangpreview

I often keep all my personal files within a sparsebundle image, and notice that the built-in Preview often freezes while viewing jpeg/gif/png/pdf files. You can see the candy spinning for a good 30 seconds before it resumes working again.

Looking inside the console, I would see the following error message

4/13/12 9:41:33.334 AM sandboxd: ([28519]) Preview(28519) deny file-issue-extension /Users/Antony/Documents/Secured.sparsebundle
4/13/12 9:41:33.334 AM Preview: Bookmark failed to issue extension for item /Users/Antony/Documents/Secured.sparsebundle (depth=4000): Operation not permitted

It comes with full report below

Preview(28519) deny file-issue-extension /Users/Antony/Documents/Secured.sparsebundle

Process:         Preview [28519]
Path:            /Applications/Preview.app/Contents/MacOS/Preview
Load Address:    0x10aeaf000
Identifier:      Preview
Version:         ??? (???)
Code Type:       X86-64 (Native)
Parent Process:  launchd [162]

Date/Time:       2012-04-13 09:41:22.280 -0500
OS Version:      Mac OS X 10.7.3 (11D50)
Report Version:  7

Backtrace:
0   libsystem_kernel.dylib          0x00007fff95ce79e2 __mac_syscall + 10
1   libsystem_sandbox.dylib         0x00007fff8b4b2f4e sandbox_extension_issue + 119
2   libsystem_sandbox.dylib         0x00007fff8b4b3461 sandbox_issue_fs_rw_extension + 32
3   CoreServicesInternal            0x00007fff8e91f7a1 _ZL28createBookmarkWithURLAtDepthPK13__CFAllocatorPK7__CFURLmS4_PK9__CFArrayR19BookmarkMutableDatajbPP9__CFError + 4420
4   CoreServicesInternal            0x00007fff8e91fd25 _ZL29addVolumeInfoForURLToBookmarkPK13__CFAllocatorR19BookmarkMutableDataPK7__CFURLmjPK9__CFArrayPP9__CFError + 1235
5   CoreServicesInternal            0x00007fff8e91f2fb _ZL28createBookmarkWithURLAtDepthPK13__CFAllocatorPK7__CFURLmS4_PK9__CFArrayR19BookmarkMutableDatajbPP9__CFError + 3230
6   CoreServicesInternal            0x00007fff8e920443 _CFURLCreateBookmarkData + 1309
7   LaunchServices                  0x00007fff8be144a3 LSSharedFileListInsertItemURL + 221
8   AppKit                          0x00007fff911b9dc4 -[NSPersistentUIManager setLSPersistentFileList:] + 1310
9   AppKit                          0x00007fff91036d62 __-[NSPersistentUIManager flushAllChangesOptionallyWaitingUntilDone:updatingSnapshots:]_block_invoke_3 + 1283
10  libdispatch.dylib               0x00007fff8f19b8ba _dispatch_call_block_and_release + 18
11  libdispatch.dylib               0x00007fff8f19d10a _dispatch_queue_drain + 264
12  libdispatch.dylib               0x00007fff8f19cf66 _dispatch_queue_invoke + 54
13  libdispatch.dylib               0x00007fff8f19c760 _dispatch_worker_thread2 + 198
14  libsystem_c.dylib               0x00007fff8a0dd3da _pthread_wqthread + 316
15  libsystem_c.dylib               0x00007fff8a0deb85 start_wqthread + 13

Binary Images:
0x7fff8a08d000 -     0x7fff8a16afef  libsystem_c.dylib (763.12.0 - compatibility 1.0.0) <FF69F06E-0904-3C08-A5EF-536FAFFFDC22> /usr/lib/system/libsystem_c.dylib
0x7fff8b4b2000 -     0x7fff8b4b3ff7  libsystem_sandbox.dylib (??? - ???) <5087ADAD-D34D-3844-9D04-AFF93CED3D92> /usr/lib/system/libsystem_sandbox.dylib
0x7fff8bda3000 -     0x7fff8be43fff  com.apple.LaunchServices (480.27.1 - 480.27.1) <4DC96C1E-6FDE-305E-9718-E4C5C1341F56> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices
0x7fff8e91a000 -     0x7fff8e945ff7  com.apple.CoreServicesInternal (113.12 - 113.12) <C37DAC1A-35D2-30EC-9112-5EEECED5C461> /System/Library/PrivateFrameworks/CoreServicesInternal.framework/Versions/A/CoreServicesInternal
0x7fff8f19a000 -     0x7fff8f1a8fff  libdispatch.dylib (187.7.0 - compatibility 1.0.0) <712AAEAC-AD90-37F7-B71F-293FF8AE8723> /usr/lib/system/libdispatch.dylib
0x7fff90fcb000 -     0x7fff91bcffff  com.apple.AppKit (6.7.3 - 1138.32) <A9EB81C6-C519-3F29-89F1-42C3E8930281> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
0x7fff95cd1000 -     0x7fff95cf1fff  libsystem_kernel.dylib (1699.22.73 - compatibility 1.0.0) <69F2F501-72D8-3B3B-8357-F4418B3E1348> /usr/lib/system/libsystem_kernel.dylib

The question is are there ways to work around the random sandbox freeze up issues? Are there permission I can set, so that Preview can behave happily? It gets to the point that I don't use Preview for PDF anymore (I use Skim).

Best Answer

The real fix hasn't truly been found yet, but there is a workaround. This issues happens when I upgraded to Lion from a clean installation of Snow Leopard.

Thus, the workaround is to clean install Lion. After that, the issue appears to have gone away. Console log is clean of Preview errors