[erlang-bugs] Mnesia/R15B: TYPE ASSERTION FAILED, erl_term.c line 109 (when stopping mnesia)

Winston Smith <>
Tue Apr 10 19:24:51 CEST 2012

On Tue, Apr 10, 2012 at 9:38 AM, Sverker Eriksson
<> wrote:
> This is an ETS-bug according to your call trace. ets:select/2 is called and
> the matchspec seems to contain '==' as the BIF seqeq_2 is called.
> db_prog_match() is the stack based VM that executes matchspec's. For some
> reason an invalid term (a "header" with two lowest bits as zero) is read
> from the stack.
> I don't have any ARM machine to test on at the moment.

It's actually AVR32 from Atmel, not ARM.

> Some debugging ideas:
> 1. Add "#define HARDDEBUG" only to erl_db*.c (the ETS-code).

I have actually enabled HARDDEBUG for everything, and had to create
some patches as it didn't compile (see other messages I sent to
erlang-questions regarding the status of HARDDEBUG).

I wil try injecting the HARDDEBUG into the ets only files.

> 2. Add "#define DMC_DEBUG" in erl_db_util.c.
> 3. Add your own erts_printf's. Use %T to print erlang terms (Eterm's).
> 4. Add a check in db_prog_match to assert that the esp-stack is ok
> before/after each instruction in the big for-loop.
> Something like
> Eterm* esp_start = esp;
> for (;;) {
>   ASSERT(esp >= esp_start);
>   for (tp = esp_start; tp < esp; tp++) {
>       ASSERT(!is_header(*tp));
>   }
>   switch (*pc++) {

I'll try this!

Thanks for the advice!


More information about the erlang-bugs mailing list