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

Mikael Pettersson <>
Thu Dec 5 12:54:10 CET 2013


Lukas Larsson writes:
 > Hello,
 > 
 > Could it be OTP-11246? It is the only gcc version related patch that I 
 > can think of.

Both test cases, mine and Erik's, are fixed by backporting two commits,

>From 9f3dc09c1a70bd485b211768bedf989bed7fbf21 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <>
Date: Mon, 12 Aug 2013 16:04:31 +0200
Subject: [PATCH] erts: Refactor non-pure macros to functions

and

>From 3b1d9f46c187ecdad3930c52fa4fbe4d547277c8 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <>
Date: Tue, 20 Aug 2013 17:19:36 +0200
Subject: [PATCH] erts: Fix bug in translating ev macros to functions

The first one suffices for the test cases, but the second one fixes
apparent errors in the first one so I'll treat them as a unit.

I'll run some more tests on our full code base.

/Mikael

 > 
 > Lukas
 > 
 > On 04/12/13 15:00, Mikael Pettersson wrote:
 > > 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.
 > >
 > > /Mikael
 > >
 > > -module(bug).
 > > -compile(export_all).
 > > doit() ->
 > >      mnesia:delete_schema([node()]),
 > >      mnesia:create_schema([node()]),
 > >      mnesia:start(),
 > >      doit(0).
 > >
 > > 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) ->
 > >      ok.
 > > _______________________________________________
 > > erlang-bugs mailing list
 > > 
 > > http://erlang.org/mailman/listinfo/erlang-bugs
 > >
 > 
 > _______________________________________________
 > erlang-bugs mailing list
 > 
 > http://erlang.org/mailman/listinfo/erlang-bugs

-- 


More information about the erlang-bugs mailing list