FORESTDB ERROR -38 and "401 unauthorized" error trying to open up ForestDB database.

24 views
Skip to first unread message

Brendan Duddridge

unread,
Aug 30, 2015, 3:24:32 PM8/30/15
to Couchbase Mobile
Hi,

I have a ForestDB database I'm trying to open, but when I do, I get this notice in the console:

02:46:15.695 WARNING: ForestDB error: FORESTDB ERROR -38


Printing description of error:

Error Domain=CBLHTTP Code=401 "401 unauthorized" UserInfo={NSLocalizedFailureReason=unauthorized, NSLocalizedDescription=401 unauthorized}


I haven't put any encryption key on the database or assigned any password. I have permissions to open the file.

Could there be some database file corruption that's causing this?

Looking in the source, I found this:

/**

* No commit headers in a database file.

*/

FDB_RESULT_NO_DB_HEADERS = -38,



So I suspect then that there is some sort of database file corruption going on here.


I'm using the latest compiled source version of CBL from master on OS X 10.11 Beta (15A263e)



Thanks,


Brendan

Jens Alfke

unread,
Aug 30, 2015, 3:35:11 PM8/30/15
to Couchbase Mobile

> On Aug 30, 2015, at 12:24 PM, Brendan Duddridge <bren...@gmail.com> wrote:
>
> FDB_RESULT_NO_DB_HEADERS = -38,
> So I suspect then that there is some sort of database file corruption going on here.

Yeah, -38 is ForestDB giving up on opening a db because it can’t find the database ‘header’ (it’s actually at the end of the file.)

In theory, ForestDB should never be able to corrupt a database. The file is append-only, so even if a write fails, the previous header will still be found and the data from before that write will still be available. (Of course some external cause could still corrupt a file, like filesystem damage, or another process somehow overwriting the file.)

One possibility is if this file was created a long time ago — I ran into this recently trying to open a Couchbase Lite database from last year. At some point during development (before it went beta) ForestDB had an incompatible change in the db header format. But I don’t think anyone outside Couchbase was using Couchbase Lite with ForestDB back then. How old is this file?

The ForestDB engineers might want to have a look at the file, if possible.

—Jens

Brendan Duddridge

unread,
Aug 31, 2015, 2:05:28 AM8/31/15
to Couchbase Mobile
Hi Jens,

Thanks for the explanation. The file was created just this past August 27, so it's not old at all.

It would be interesting to send it off to someone on the ForestDB team to take a look at it if they want.

Who do I send it to?

Thanks,

Brendan
Reply all
Reply to author
Forward
0 new messages