Simon, Thanks very much for this information.
Rob. > On 14 Aug 2015, at 17:38, Simon Slavin <slavins at bigfraud.org> wrote: > > > On 14 Aug 2015, at 4:17pm, skywind mailing lists <mailinglists at skywind.eu> > wrote: > >> this is the problem. I could never reproduce it by myself and even my >> customers have normally no problems. But it happens once a year or so to one >> of my customers. >> Still this is very annoying as it results in data loss. > > I have seen a problem like this only in one context, and it had nothing to do > with SQLite. When an iDevice's power starts running low, it sends out > notifications to all running Apps and expects their cooperation in shutting > down. An App is meant to react to the notification and shut down in less > than (IIRC) 6 seconds, without depending on network connections and without > using unusual amounts of power. > > If one of the running Apps does not do this properly then the operating > system is allowed to terminate it at (IIRC) 10 seconds, even if it is still > working. But if the application is really annoying it can block other apps > -- like yours -- from shutting down before the power is lost, by hogging > resources like CPU or file storage. So your app gets terminated at 10 > seconds even though it wasn't given a chance to close its files. Either by > the OS or because the device just ran out of power. > > This could happen because of a bug. But I saw it happen in a big corporate > application where the programmer decided that it just had to do a ton of > communication with the server and clean up files every time the app quit. > Reasonable on a desktop computer and a disaster on a phone. > > Testing correct quit behaviour is part of Apple's approval process. But it > can't test every state the app may be in when it receives a quit notification. > > So the thing that might be triggering your corruption is that your customer > is running another application at the same time -- one which hogs resources > so much that your own application doesn't get a chance to shut down cleanly > before the power runs out. You're never going to be able to figure out the > problem in your own app, because there isn't one. You need to look at the > environment as a whole. > > One possible way to proceed is to ask the customer what other apps they were > likely to have had running when the device ran out of power. Then google > those apps and see if there is any suggestion that any of them might be badly > written or badly behaved on shutdown. > > Simon. > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users