error calling sqlite3_step (11: database disk image is malformed) rs

424 views
Skip to first unread message

Phaniteja N

unread,
Dec 10, 2014, 12:45:48 AM12/10/14
to mobile-c...@googlegroups.com, phani...@tcs.com, br.a...@tcs.com, kanya...@tcs.com, rubha.s...@tcs.com
Hi,
The following error is returned when we call the "databaseNamed:" method and the iOS app gets crashed after that.

Dec 10 11:40:45 ITD-0002 BEST[436] <Warning>: Unknown error calling sqlite3_step (11: database disk image is malformed) rs
Dec 10 11:40:45 ITD-0002 BEST[436] <Warning>: WARNING: CBLDatabase: Could not initialize schema of /var/mobile/Containers/Data/Application/9C58CE5E-0260-4761-A799-B5B6AB106837/Library/Application Support/CouchbaseLite/cabincrew.cblite -- May be an old/incompatible format. SQLite error: database disk image is malformed

Please find below the code that has been written to call the databaseNamed: method. Also, the device console log, crash log are attached for your reference. Could you please help to fix this problem.

+ (BOOL)createDataBase:(NSString *)databaseName {
    BOOL status = false;
    CBLManager *cblManager = [[CBLManager sharedInstance]copy];
    BOOL isvalidDBName = [CBLManager isValidDatabaseName:databaseName];
    if (isvalidDBName) {
        NSError *error;
        CBLDatabase *couchDB = [cblManager databaseNamed:databaseName error:&error];
        if (couchDB != nil) {
            couchDB.maxRevTreeDepth = 1;
            [couchDB setFilterNamed:P2P_REPLICATION_FILTER_NAME asBlock:^BOOL(CBLSavedRevision *revision, NSDictionary *params) {
                if ([[revision.properties objectForKey:@"shared"] boolValue] || revision.isDeletion) {
                    return YES;
                } else {
                    return NO;
                }
            }];
            status = true;
        }
    }
    return status;
}

Thanks & Regards,
Phaniteja N
BEST 10-12-14 11-02 31324am.crash
BEST_Appcrash_device_log.rtf

Jens Alfke

unread,
Dec 10, 2014, 1:16:46 AM12/10/14
to mobile-c...@googlegroups.com, phani...@tcs.com, br.a...@tcs.com, kanya...@tcs.com, rubha.s...@tcs.com

On Dec 9, 2014, at 9:45 PM, Phaniteja N <phanitej...@gmail.com> wrote:

Dec 10 11:40:45 ITD-0002 BEST[436] <Warning>: Unknown error calling sqlite3_step (11: database disk image is malformed) rs
Dec 10 11:40:45 ITD-0002 BEST[436] <Warning>: WARNING: CBLDatabase: Could not initialize schema of /var/mobile/Containers/Data/Application/9C58CE5E-0260-4761-A799-B5B6AB106837/Library/Application Support/CouchbaseLite/cabincrew.cblite -- May be an old/incompatible format. SQLite error: database disk image is malformed

Note: "database disk image is malformed".
Looks like the local database file has been corrupted somehow. Try deleting the app and re-installing it.

Did this just happen once on one device, or is it reproducible?

—Jens

Jens Alfke

unread,
Dec 10, 2014, 1:32:30 AM12/10/14
to Phaniteja N, br.a...@tcs.com, kanya...@tcs.com, mobile-c...@googlegroups.com, rubha.s...@tcs.com
Please reply to the list, not to me personally.

On Dec 9, 2014, at 10:27 PM, Phaniteja N <phani...@tcs.com> wrote:

Hi Jens,
Thanks for the reply. The app works fine after re-installation. This issue occurrence is very random as I have encountered it 2 - 3 times in past 8 months period of the app usage. However, could you please help us to know how we need to troubleshoot this issue and solution if any.

Thanks & Regards
Phaniteja N

=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you



Jens Alfke

unread,
Dec 10, 2014, 1:46:09 AM12/10/14
to mobile-c...@googlegroups.com, Phaniteja N, br.a...@tcs.com, kanya...@tcs.com, rubha.s...@tcs.com
(Oops, apparently you did reply to the list; just somehow it went to my inbox. My mail rule must have misbehaved.)

I don't have any solution, or really any idea what's going wrong. No one else has reported this, so I don't think it's a problem with Couchbase Lite itself.

Somehow, something is corrupting the SQLite database. SQLite is very fault-tolerant, so it wouldn't be an app crash. It almost has to be something directly writing to (or truncating) the database file itself, and I have no idea what that could be.

You could try to get a copy of the damaged database file and examine it; maybe something obvious is wrong, like it got truncated to zero length. Otherwise, I'm not sure how to diagnose the corruption.

—Jens


--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/57FBD09A-EE1F-4892-B2CF-956D1C9C1B6B%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages