lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Arseny Vakhrushev wrote:
> > I don't see anything that could go wrong in the above loop itself.
> > Probably something else messed up the 'users' table first.
> 
> What might that be for instance? Anything?

Any piece of code which modifies tables could be the culprit.

> What kind of inconsistency is causing the error?

Corrupted memory in the hash part of a table.

> I tried to dig into the piece of code which fires it and saw a
> comment - /* Unreachable */. Should I be worrying that this
> condition can cause crash?

No.

> > Or you could add the following before lj_err_msg(L, LJ_ERR_NEXTIDX)
> > in lj_tab.c:
> 
> >   printf("key: %08x %08x\n", key->u32.hi, key->u32.lo);
> >   printf("x/%dx %p\n", 3*(t->hmask+1), noderef(t->node));
> 
> Aha, ok. I will add that.
> 
> > Run the app with gdb and set a breakpoint on the lj_err_msg. After
> > the breakpoint hits, run the printed gdb command and send me the
> > complete output.
> 
> It is not so simple to do that since the app is serving
> thousands of clients in realtime and can't be stopped whenever I
> want it.:-) I will try to cook a stress test emulating the
> behavior which caused the error, and run it with gdb.

You could dump the memory directly from the C code, e.g.:

  {
    MSize i;
    printf("key: %08x %08x\n", key->u32.hi, key->u32.lo);
    n = noderef(t->node);
    for (i = 0; i <= t->hmask; i++, n++)
     printf("[%04d] %p: %08x %08x  %08x %08x  %p\n", i, n,
	    n->val.u32.hi, n->val.u32.lo, n->key.u32.hi, n->key.u32.lo,
	    nextnode(n));
  }

--Mike