Hi,

We've now started to receive regular access violation after running our application for about 30-45 minutes of heavy processing. We are at commit 5bda356 and running under Windows 2k8 R2 Datacenter, service pack 1

Here's what I found from the log file produced by the Java JVM about crashing.

The issue happens after our application call db_put. It occurs in mdb_xcursor_init0 (inlined within mdb_cursor_init) at:

    if (txn->mt_dbs[dbi].md_flags & MDB_DUPSORT) {
        mdb_tassert(txn, mx != NULL);
        mc->mc_xcursor = mx;
        mdb_xcursor_init0(mc);

mdb_xcursor_init0(MDB_cursor *mc)
{
    MDB_xcursor *mx = mc->mc_xcursor;

    mx->mx_cursor.mc_xcursor = NULL;  <------here

or:
  0000000180008A9C: 4D 89 4B 10        mov         qword ptr [r11+10h],r9    //mc->mc_xcursor = mx; (6736)
  0000000180008AA0: 49 89 59 10        mov         qword ptr [r9+10h],rbx    //mx->mx_cursor.mc_xcursor = NULL; (6651)

Looking at the register it is clear that cursor_init is called with a dbi of zero and a null mx pointer.

From the stack I was able to trace the call to mdb_cursor_init to come from mdb_page_alloc at:

if (op == MDB_FIRST) {    /* 1st iteration */
 /* Prepare to fetch more and coalesce */
  oldest = mdb_find_oldest(txn);
  last = env->me_pglast;
  mdb_cursor_init(&m2, txn, FREE_DBI, NULL);   <-----here

the question then is why and how we can have had dupsort turned on for FREE_DBI so that init cursor could have triggered this code.

I am working on publishing a change to the above line to disregard FREE_DBI, but that looks like a patch that doesn't address the cause of this issue:
    if (dbi && txn->mt_dbs[dbi].md_flags & MDB_DUPSORT) {

I'm at a real lost how DUPSORT can ever be turned on for FREE_DBI and if that's now a symptom a another problem.

Thanks for you help and insight
Alain