Nick Richards created CB-1316:
---------------------------------

             Summary: Lose contents of localStorage if backed up while Journal 
emptying: "Error: database disk image is malformed"
                 Key: CB-1316
                 URL: https://issues.apache.org/jira/browse/CB-1316
             Project: Apache Cordova
          Issue Type: Bug
    Affects Versions: 1.8.1
         Environment: iOS 5.1+
            Reporter: Nick Richards
            Priority: Critical


The v1.6.1 workaround/fix CB-330 for iOS 5.1's localStorage iCloud-related 
file-deletion allows me to use localStorage in my app.  However localStorage is 
sporadically and thereafter persistently blank when I relaunch my application.  

Further, when I Download the application via Xcode Organizer to my Mac and open 
it using SQLITE3 the database is reported to be corrupt: "Error: database disk 
image is malformed" is what sqlite says.  This is seen in 
[xcappdata]/AppData/Documents/Backups/localstorage.appdata.db as well as 
AppData/Library/Caches/file__0.localstorage, after an app exit and restart.  
Sometimes I must time things to rapidly exit after writing to the database for 
this situation to occur.  Also my application is set to exit when the user 
backgrounds it, via the info.plist "Application does not run in background" 
(aka UIApplicationExitsOnSuspend = YES) setting.

I expect the localStorage DB to not be corrupted / blank when I resume my 
application.

I once saw a SQLITE DB Journal file show up: 
AppData/Library/Caches/file__0.localstorage.journal in Xcode's Organizer window 
while I was using my app.  This got me thinking that Cordova's 
https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVLocalStorage.m
 CB-330 implementation needs a tweak:  wait to perform the backup until after 
the Journal file has been written.  I figure if Cordova backs-up the database 
while the Journal is still being emptied then we'll get a corrupted 
localStorage!

Thank you,
Nick

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to