Closed adamski closed 7 years ago
The db_uuid is not the same when the app restarts. Do you somehow delete / recreate the database?
This is what I've been trying to work out, but there is nowhere in the code where I am deleting or re-recreating it, stepped through with the debugger a few times, but that must be what's happening. Will try and investigate more.
I would recommend to turn some logging (Database, Router, Listener) on but I don't know how to do that the react-native plugin.
@jamiltz do you know what could cause this issue when using the react-native plugin? and how to enable the logging from the plugin?
I will look at the iOS docs - should be easy enough to alter the Objective-C code to turn on logging.
For Objective-C,
[CBLManager enableLogging:@"Database"];
[CBLManager enableLogging:@"Router"];
[CBLManager enableLogging:@"Listener"];
So, looking at the logs, it seems that after a restart (also rebuild in this case) the location of the cblite database has changed:
19:36:40.808‖ Database: Created CBLManager[0x7b934b60 /Users/username/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/DCEEB002-5330-4BD1-9A98-211473E4141D/Library/Application Support/CouchbaseLite]
19:36:40.809‖ Database: CBLManager[0x7b93c5b0 /Users/username/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/DCEEB002-5330-4BD1-9A98-211473E4141D/Library/Application Support/CouchbaseLite] created CBL_RunLoopServer[0x7b91df70] (with CBLManager[0x7b934b60 /Users/username/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/DCEEB002-5330-4BD1-9A98-211473E4141D/Library/Application Support/CouchbaseLite])
2
19:36:41.264‖ Database: Opening CBLDatabase[<0x7b8351d0>mydb]
19:36:41.264‖ Database: Using CBL_SQLiteStorage for db at /Users/username/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/DCEEB002-5330-4BD1-9A98-211473E4141D/Library/Application Support/CouchbaseLite/mydb.cblite2; upgrade=0
19:36:41.264‖ Database: Opening <CBL_SQLiteStorage: 0x7b835800>
19:36:41.264‖ Database: Open /Users/username/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/DCEEB002-5330-4BD1-9A98-211473E4141D/Library/Application Support/CouchbaseLite/mydb.cblite2/db.sqlite3 with SQLite (flags=6(null))
19:36:41.265‖ Database: No pending doc expirations
19:36:41.267‖ Listener: Response[GET /mydb] --> 200
19:36:41.268‖ Router: Response -- status=200, body=197 bytes
//---- After rebuild / restart -------------------------------
19:39:42.473‖ Database: Created CBLManager[0x787d9ba0 /Users/username/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/4D393910-A127-4F62-A4C3-DA132BB7CF26/Library/Application Support/CouchbaseLite]
19:39:42.474‖ Database: CBLManager[0x79d4d040 /Users/username/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/4D393910-A127-4F62-A4C3-DA132BB7CF26/Library/Application Support/CouchbaseLite] created CBL_RunLoopServer[0x787a5d00] (with CBLManager[0x787d9ba0 /Users/username/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/4D393910-A127-4F62-A4C3-DA132BB7CF26/Library/Application Support/CouchbaseLite])
19:39:42.886‖ Database: Opening CBLDatabase[<0x7870b7e0>mydb]
19:39:42.886‖ Database: Using CBL_SQLiteStorage for db at /Users/username/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/4D393910-A127-4F62-A4C3-DA132BB7CF26/Library/Application Support/CouchbaseLite/mydb.cblite2; upgrade=0
19:39:42.886‖ Database: Opening <CBL_SQLiteStorage: 0x7870be00>
19:39:42.886‖ Database: Open /Users/username/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/4D393910-A127-4F62-A4C3-DA132BB7CF26/Library/Application Support/CouchbaseLite/mydb.cblite2/db.sqlite3 with SQLite (flags=6(null))
19:39:42.887‖ Database: No pending doc expirations
19:39:42.889‖ Listener: Response[GET /mydb] --> 200
19:39:42.889‖ Router: Response -- status=200, body=197 bytes
So I'm wondering if I need to use initWithDirectory
? However I then lose the ability to use the sharedInstance
... This shouldn't be needed though right?
I have another app, (which uses a previous version of react-native-couchbase-lite
) which does not have this issue...
Restarting the app shouldn't change the location of the app. It seems like the issue happens when rebuilding the app? I have never developed a react-native app. Could you ask react-native forum or create an issue at react-native-couchbase-lite repo?
CC: @jamiltz
@pasin, its also on app restarts that the data is lost - I need to work out how to re-attach the debugger to after restart to check the log output.
So I'm wondering if I need to use initWithDirectory? However I then lose the ability to use the sharedInstance... This shouldn't be needed though right?
Correct. The initWithAuth:password:callback:
bridging method in the plugin is using [CBLManager sharedInstance];
so the location is the default one.
And yes it sounds like a different iOS container is used every time the app is restarted. I don't think CBL could even be allowed to do this by the OS. Does it happen when running on device as well?
-CBLManager[0x7b93c5b0 /Users/username/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/DCEEB002-5330-4BD1-9A98-211473E4141D/Library/Application Support/CouchbaseLite] created CBL_RunLoopServer[0x7b91df70] (with CBLManager[0x7b934b60 /Users/username/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/DCEEB002-5330-4BD1-9A98-211473E4141D/Library/Application Support/CouchbaseLite])
+CBLManager[0x79d4d040 /Users/username/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/4D393910-A127-4F62-A4C3-DA132BB7CF26/Library/Application Support/CouchbaseLite] created CBL_RunLoopServer[0x787a5d00] (with CBLManager[0x787d9ba0 /Users/username/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/4D393910-A127-4F62-A4C3-DA132BB7CF26/Library/Application Support/CouchbaseLite])
Yes it also happens on device. Need to do some more debugging to see whats going on..
I tried out an alternative library (which uses native calls to this library without the REST listener).
I'd been meaning to try it out anyway, but it has not solved my issue. App restarts are still trashing the database. Replication should not be overwriting documents (right?). There must be something else going on. There is some Objective-C code which gets document data and an attachment, but I can't see how that would be affecting the database.
You can try to use an app like SimPholders to find where the simulator is storing the CBL database. Then see what happens to it between app restarts. The replication doesn't overwrite documents. Have you checked that the app code isn't calling DELETE /{db}
when quitting the app which would delete the database?
Below are example logs from the app. Nowhere in the code or the logs is it being deleted.
11:04:50.442| Database: Opening CBLDatabase[<0x7d810e20>mydb]
11:04:50.443| Database: Using CBL_SQLiteStorage for db at /Users/userhome/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/8E302128-C5A4-417B-B59E-CEA788AC3E00/Library/Application Support/CouchbaseLite/mydb.cblite2; upgrade=0
11:04:50.444| Couchbase Lite using SQLite version 3.16.0 (2016-11-04 19:09:39
0e5ffd9123d6d2d2b8f3701e8a73cc98a3a7ff5f)
11:04:50.444| FYI, couldn't enable SQLite mmap: error 21
11:04:50.444| Database: Opening <CBL_SQLiteStorage: 0x7c73d050 >
11:04:50.444| Database: Open /Users/userhome/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/8E302128-C5A4-417B-B59E-CEA788AC3E00/Library/Application Support/CouchbaseLite/mydb.cblite2/db.sqlite3 with SQLite (flags=6(null))
11:04:50.452| Database: No pending doc expirations
//-------------------------
11:04:50.583| Database: Created CBLManager[0x7c73c6e0 /Users/userhome/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/8E302128-C5A4-417B-B59E-CEA788AC3E00/Library/Application Support/CouchbaseLite]
11:04:50.583| Database: CBLManager[0x79975f90 /Users/userhome/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/8E302128-C5A4-417B-B59E-CEA788AC3E00/Library/Application Support/CouchbaseLite] created CBL_RunLoopServer[0x7c73c900] (with CBLManager[0x7c73c6e0 /Users/userhome/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/8E302128-C5A4-417B-B59E-CEA788AC3E00/Library/Application Support/CouchbaseLite])
11:04:50.583‖ Database: Opening CBLDatabase[<0x7c73cac0>mydb]
11:04:50.583‖ Database: Using CBL_SQLiteStorage for db at /Users/userhome/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/8E302128-C5A4-417B-B59E-CEA788AC3E00/Library/Application Support/CouchbaseLite/mydb.cblite2; upgrade=0
11:04:50.584‖ Database: Opening <CBL_SQLiteStorage: 0x7c73d050>
11:04:50.584‖ Database: Open /Users/userhome/Library/Developer/CoreSimulator/Devices/134A36A7-072D-4E5C-8D54-40D196E0222A/data/Containers/Data/Application/8E302128-C5A4-417B-B59E-CEA788AC3E00/Library/Application Support/CouchbaseLite/mydb.cblite2/db.sqlite3 with SQLite (flags=6(null))
2
11:04:50.585‖ Database: No pending doc expirations
Apologies for the long log output, this is from the device: Initial load after app install and then close and restart. Are there any clues here?
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: Opening CBLDatabase[<0x16d491a0>mydb]
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: Using CBL_SQLiteStorage for db at /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite/mydb.cblite2; upgrade=0
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Couchbase Lite using SQLite version 3.8.10.2 (2015-05-20 18:17:19 2ef4f3a5b1d1d0c4338f8243d40a2452cc1f7fe4)
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: Opening <CBL_SQLiteStorage: 0x16d0e3c0>
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: Open /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite/mydb.cblite2/db.sqlite3 with SQLite (flags=6(null))
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: No pending doc expirations
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: Created CBLManager[0x16e14150 /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite]
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: CBLManager[0x16d69000 /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite] created CBL_RunLoopServer[0x16d01320] (with CBLManager[0x16e14150 /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite])
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: Opening CBLDatabase[<0x16e17450>mydb]
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: Using CBL_SQLiteStorage for db at /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite/mydb.cblite2; upgrade=0
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: Opening <CBL_SQLiteStorage: 0x16d4b3e0>
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: Open /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite/mydb.cblite2/db.sqlite3 with SQLite (flags=6(null))
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: No pending doc expirations
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 1)
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: DEALLOC CBLRemoteLogin[https://myaccount.cloudant.com/mydb-free]
Jul 26 12:10:19 Adams-iPhone MyApp[649] <Warning>: Database: CBL_BlobStore /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite/mydb.cblite2/attachments created tempDir /private/var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/tmp/(A Document Being Saved By MyApp 4)
Jul 26 12:10:20 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:10:20 Adams-iPhone MyApp[649] <Warning>: Database: INSERT {innovative #3-bdb12eeffbbea3da2b6bc93994109263}, history[3]
Jul 26 12:10:20 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 2)...
Jul 26 12:10:20 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 2)
Jul 26 12:10:20 Adams-iPhone MyApp[649] <Warning>: Database: ---> Added: {innovative #3-bdb12eeffbbea3da2b6bc93994109263} as seq 3
Jul 26 12:10:20 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 1)
//... [replicating docs]
Jul 26 12:10:20 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 2)...
Jul 26 12:10:20 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 2)
Jul 26 12:10:20 Adams-iPhone MyApp[649] <Warning>: Database: ---> Added: {leisure #3-a7756d997e3279ef4e2d34cf4e1a14d4} as seq 65
Jul 26 12:10:20 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 1)
Jul 26 12:10:43 Adams-iPhone kbd[145] <Warning>: -[PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:](898): CoreData: Ubiquity: mobile~4BA6AD8E-5571-56DF-B552-2DE48A40D519:UserDictionary
Using local storage: 1 for new NSFileManager current token <fb20c96e 77eb368c a2590ff3 0b49b0fc bfb2b152>
// ---- Making changes to a document -----
Jul 26 12:10:45 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:10:45 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 1)
Jul 26 12:10:45 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:10:45 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 2)...
Jul 26 12:10:45 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 2)
Jul 26 12:10:45 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 2)...
Jul 26 12:10:45 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 2)
Jul 26 12:10:45 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 1)
Jul 26 12:10:45 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:10:45 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 1)
Jul 26 12:10:45 Adams-iPhone kbd[145] <Warning>: -[PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:](898): CoreData: Ubiquity: mobile~4BA6AD8E-5571-56DF-B552-2DE48A40D519:UserDictionary
Using local storage: 0 for new NSFileManager current token <fb20c96e 77eb368c a2590ff3 0b49b0fc bfb2b152>
Jul 26 12:10:46 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:10:46 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 1)
Jul 26 12:10:46 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:10:46 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 1)
Jul 26 12:10:46 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:10:46 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 1)
Jul 26 12:10:51 Adams-iPhone MyApp[649] <Warning>: Database: Created CBLManager[0x16d198c0 /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite]
Jul 26 12:10:51 Adams-iPhone MyApp[649] <Warning>: Database: CBLManager[0x16d198c0 /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite] is the sharedInstance
Jul 26 12:10:51 Adams-iPhone MyApp[649] <Warning>: Database: Opening CBLDatabase[<0x16f62da0>mydb]
Jul 26 12:10:51 Adams-iPhone MyApp[649] <Warning>: Database: Using CBL_SQLiteStorage for db at /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite/mydb.cblite2; upgrade=0
Jul 26 12:10:51 Adams-iPhone MyApp[649] <Warning>: Database: Opening <CBL_SQLiteStorage: 0x16f61cd0>
Jul 26 12:10:51 Adams-iPhone MyApp[649] <Warning>: Database: Open /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite/mydb.cblite2/db.sqlite3 with SQLite (flags=6(null))
Jul 26 12:10:51 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:10:51 Adams-iPhone MyApp[649] <Warning>: Database: <CBL_SQLiteStorage: 0x16f61cd0>: Optimizing SQL indexes (curSeq=65, last run at 0)
Jul 26 12:10:51 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 1)
Jul 26 12:10:51 Adams-iPhone MyApp[649] <Warning>: Database: No pending doc expirations
Jul 26 12:10:51 Adams-iPhone MyApp[649] <Warning>: Got document this at rev CBLSavedRevision[this/3-56a374f3398b68b8fe373b7b9e76385b]
Jul 26 12:10:56 Adams-iPhone MyApp[649] <Warning>: Database: PUT _id=this, _rev=3-56a374f3398b68b8fe373b7b9e76385b (allowConflict=0)
Jul 26 12:10:56 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:10:56 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 1)
Jul 26 12:10:56 Adams-iPhone MyApp[649] <Warning>: Database: ---> Added: {this #4-e76097303057930999e95aa7a2594a1c} as seq 66
Jul 26 12:10:56 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:10:56 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 1)
Jul 26 12:10:56 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:10:56 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 2)...
Jul 26 12:10:56 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 2)
Jul 26 12:10:56 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 2)...
Jul 26 12:10:56 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 2)
Jul 26 12:10:56 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 1)
Jul 26 12:10:56 Adams-iPhone MyApp[649] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:10:56 Adams-iPhone MyApp[649] <Warning>: Database: }} Commit transaction (level 1)
Jul 26 12:10:58 Adams-iPhone kernel[0] <Notice>: 170937.566762 wlan0.A[7006] updateLinkQualityMetrics@1991:Report LQM to User Land 50, fAverageRSSI -71
Jul 26 12:11:05 Adams-iPhone SpringBoard[48] <Warning>: BSXPCMessage received error for message: Connection interrupted
Jul 26 12:11:06 Adams-iPhone MyApp[649] <Error>: 12:11:06.669 ERROR: [Juce Message Thread] AVAudioSession.mm:692: -[AVAudioSession setActive:withOptions:error:]: Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session.
Jul 26 12:11:08 Adams-iPhone mediaserverd[43] <Notice>: '' com.oup.elt.mydb2(pid = 649) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Jul 26 12:11:08 Adams-iPhone mediaserverd[43] <Notice>: '' (pid = 649) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Jul 26 12:11:08 Adams-iPhone SpringBoard[48] <Warning>: Application 'UIKitApplication:com.oup.elt.mydb2[0xf4cb]' exited voluntarily.
// --------------- App close and restart ----------------------
Jul 26 12:11:08 Adams-iPhone UserEventAgent[23] <Warning>: 4102748831033: id=com.oup.elt.mydb2 pid=649, state=0
Jul 26 12:11:15 Adams-iPhone SpringBoard[48] <Error>: SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Jul 26 12:11:15 Adams-iPhone SpringBoard[48] <Error>: SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Jul 26 12:11:16 Adams-iPhone kernel[0] <Notice>: xpcproxy[650] Container: /private/var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36 (sandbox)
Jul 26 12:11:16 Adams-iPhone com.apple.xpc.launchd[1] <Error>: assertion failed: 13G36: launchd + 85529 [083E000D-4C31-3B98-A2C4-6FADB4D1940F]: 0x3
Jul 26 12:11:19 Adams-iPhone MyApp[650] <Warning>: Default directory for CBLManager: /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Database: Opening CBLDatabase[<0x15553d30>mydb]
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Database: Using CBL_SQLiteStorage for db at /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite/mydb.cblite2; upgrade=0
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Couchbase Lite using SQLite version 3.8.10.2 (2015-05-20 18:17:19 2ef4f3a5b1d1d0c4338f8243d40a2452cc1f7fe4)
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Database: Opening <CBL_SQLiteStorage: 0x156ee670>
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Database: Open /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite/mydb.cblite2/db.sqlite3 with SQLite (flags=6(null))
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Database: No pending doc expirations
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Database: Created CBLManager[0x15512600 /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite]
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Database: CBLManager[0x155ab9e0 /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite] created CBL_RunLoopServer[0x15512720] (with CBLManager[0x15512600 /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite])
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Database: Opening CBLDatabase[<0x156b7ed0>mydb]
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Database: Using CBL_SQLiteStorage for db at /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite/mydb.cblite2; upgrade=0
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Database: Opening <CBL_SQLiteStorage: 0x156f5040>
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Database: Open /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite/mydb.cblite2/db.sqlite3 with SQLite (flags=6(null))
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Database: No pending doc expirations
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: Database: }} Commit transaction (level 1)
Jul 26 12:11:20 Adams-iPhone MyApp[650] <Warning>: DEALLOC CBLRemoteLogin[https://myaccount.cloudant.com/mydb-free]
Jul 26 12:11:21 Adams-iPhone MyApp[650] <Warning>: Database: CBL_BlobStore /var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/Library/Application Support/CouchbaseLite/mydb.cblite2/attachments created tempDir /private/var/mobile/Containers/Data/Application/B123026C-58B6-464A-9AB5-ACA3BD6ACC36/tmp/(A Document Being Saved By MyApp 5)
Jul 26 12:11:21 Adams-iPhone MyApp[650] <Warning>: Database: {{ Begin transaction (level 1)...
Jul 26 12:11:21 Adams-iPhone MyApp[650] <Warning>: Database: INSERT {innovative #3-bdb12eeffbbea3da2b6bc93994109263}, history[3]
Jul 26 12:11:21 Adams-iPhone MyApp[650] <Warning>: Database: {{ Begin transaction (level 2)...
Jul 26 12:11:21 Adams-iPhone MyApp[650] <Warning>: Database: }} Commit transaction (level 2)
Jul 26 12:11:21 Adams-iPhone MyApp[650] <Warning>: Database: ---> Added: {innovative #3-bdb12eeffbbea3da2b6bc93994109263} as seq 3
Jul 26 12:11:21 Adams-iPhone MyApp[650] <Warning>: Database: }} Commit transaction (level 1)
//... [replicating docs]
Jul 26 12:11:22 Adams-iPhone MyApp[650] <Warning>: Database: INSERT {thing #3-9ee5fa7573d68a1c4473f74dcd21371a}, history[3]
Jul 26 12:11:22 Adams-iPhone MyApp[650] <Warning>: Database: {{ Begin transaction (level 2)...
Jul 26 12:11:22 Adams-iPhone MyApp[650] <Warning>: Database: }} Commit transaction (level 2)
Jul 26 12:11:22 Adams-iPhone MyApp[650] <Warning>: Database: ---> Added: {thing #3-9ee5fa7573d68a1c4473f74dcd21371a} as seq 65
Jul 26 12:11:22 Adams-iPhone MyApp[650] <Warning>: Database: }} Commit transaction (level 1)
@jamiltz I've just tried using SimPholders (nice tip), and the db is deleted and recreated on startup. At least I know when its happening now.
Hi guys, thanks to your hints, I finally managed to track down the culprit - I'm working with some legacy code, and there was a line that was deleting the entire Application Support dir on startup (!!), taking the cblite file with it. All working now.
Np. Glad you found out what was going on :)
Some strange behaviour here. Documents are not persisting across restarts. I'm using the REST API (with a React Native app, via https://github.com/couchbaselabs/react-native-couchbase-lite)
Below is the output of the GET /db/ response at various stages.
After replication:
After document revision:
After app restart:
After replication:
... and so on.
This is on both debug and release, also on device. Any clues?