bmatsuo / lmdb-go

Bindings for the LMDB C library
BSD 3-Clause "New" or "Revised" License
159 stars 58 forks source link

mdb_cursor_get: MDB_PAGE_NOTFOUND: Requested page not found #85

Closed ghost closed 8 years ago

ghost commented 8 years ago

When will this error happen? What's the influence? May it be ignore?

bmatsuo commented 8 years ago

I think this is a pretty serious error. The following is an excerpt from lmdb.h:

    /** Requested page not found - this usually indicates corruption */
#define MDB_PAGE_NOTFOUND   (-30797)

I can't find any information about why this error occurs. You may need to resort to contacting the openldap-technical mailing list (official source of help for LMDB).

Are you using any exotic flags when opening the environment? A fancy filesystem perhaps? Might you have the environment open twice in the same process? I am basically shooting into the dark though. I would validate that you are managing the environment correctly (reading both Go and C docs probably).

I can try to help clarify things in the docs. But you will likely need to do some detective work to figure out the cause.

ghost commented 8 years ago

@bmatsuo I run four readers and four writers in one process, each of readers and writers is a independent goroutine. they all open the same environment(env path is the same). Is this the problem?

bmatsuo commented 8 years ago

It sounds like that may be the cause. You must only have one Env open for each path in use by your program. All transactions should be created using the same environment (you shouldn't need synchronization for this -- it's already handled by the library). Just do all the Env setup in one goroutine and pass the initialized/open Env to all your worker goroutines.

Let me know how that goes.

ghost commented 8 years ago

@bmatsuo I have made sure open the same env in multi goroutines (in a process) make this cause.