Re: Crash when move open document based app file to trash
Re: Crash when move open document based app file to trash
- Subject: Re: Crash when move open document based app file to trash
- From: Jens Alfke <email@hidden>
- Date: Mon, 13 Apr 2015 09:10:58 -0700
> On Apr 13, 2015, at 7:01 AM, Mike Abdullah <email@hidden> wrote:
>
> I’m not sure how careful that monitoring is, though, whether it happens continuously, or only at the moment the app or document regains focus.
Even if it’s continuous, it can’t be continuous enough, since the OS is multithreaded. There’s always the possibility of a race condition where the app tries to access the file after it’s been moved but before the notification arrives. Therefore the app can’t rely on the notification as its only source of truth.
Jonathan: Does the app enable SQLite’s WAL (write-ahead log)? If it does, it should be more resilient to its files being moved. The reason is that the non-WAL behavior creates and deletes temporary files during every transaction, which implies that SQLite has to know the correct path to the database at that time. In WAL mode, as far as I can tell, the side files are more persistent and don’t get created or deleted in the middle of use.
(As a bonus, WAL mode is generally a lot faster too!)
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden