[erlang-bugs] mnesia/dets breakage when otp R15B03-1 is compiled by gcc 4.8 or 4.9

Mikael Pettersson <>
Wed Dec 4 15:00:33 CET 2013

We're using otp R15B03-1 on x86_64-linux.  During initialization of our
application we create a bunch of mnesia disc_copies tables.  If otp
was compiled by gcc 4.8 or 4.9, then during the creation of the 257th
mnesia table DETS spews the following warning

dets: file "/...//schema.DAT" not properly closed, repairing ...

but the mnesia:create_table/2 call doesn't fail.  However the schema.DAT
file is corrupt and subsequent usage of mnesia fails.

If otp R15B03-1 is compiled with gcc 4.7 or 4.6 the problem doesn't occur.

If we use otp R16B02 compiled by gcc 4.8 or 4.9 the problem doesn't occur.

At the moment we can't upgrade to R16B02, and as our developers upgrade their
machines to newer Linux distributions they get gcc-4.8 as their system compiler
and things break.

Are there any known bug fixes in R16 that may be related to this?

I'm appending the trivial reproducer below.


doit() ->

doit(I) when I < 260 ->
    D0 = $0 + (I rem 10),
    D1 = $0 + ((I div 10) rem 10),
    D2 = $0 + ((I div 100) rem 10),
    Name = list_to_atom([$f, $o, $o, D2, D1, D0]),
    io:format("creating table ~p~n", [Name]),
    TabDef = [{disc_copies,[node()]}, {type,set}, {attributes,[key,val]}],
    {atomic, ok} = mnesia:create_table(Name, TabDef),
    doit(I + 1);
doit(_I) ->

More information about the erlang-bugs mailing list