[erlang-questions] bad_object in mnesia

Geoff Cant <>
Wed Jun 20 05:36:44 CEST 2007


Erik Stenman <> writes:

> Has anyone had any experience with mnesia returning bad_object?

Just hit this bug this morning. A disc_only_copies table filled up
some time ago and I then tried to do mnesia:backup("filename"). This
returned:

{error,{error,{"Tab copier iteration failed",
               {error,{bad_object,"/path/to/table_in_question.DAT"}}}}}

As I knew the table only gets used at 4am, I deleted the copy, copied
the DAT file away and recreated the table.

Subsequent opening of the dat file with dets required a table repair
which succeeded.

> Every now and then one of our mnesia database tables breaks in some way.
> The breakage manifests itself in one of two ways:
>  1. Transactions on the tables aborts with {badarg, [TABLENAME]}
>  2. Reads on the table returns {error, {bad_object, "FULLPATH_TO_TABLENAME.DAT"}}
> This happens in a running system where the table has been used for a long time.

The system had been running since 2007-03-28.

> I can not find any documentation in mnesia (nor in dets) stating that mnesia
> can return the error code bad_object.
> Has anyone seen any documentation of this?
> Is it a bug in mnesia or in the documentation?
> (I.e. is this supposed to be happening and it is just not documented?
>  In that case what are you supposed to do when you get such an error message?)
>
> The error seems to indicate that the table is corrupt in some way.
> Sometimes the table can be fixed by simply restarting mnesia,
> sometimes we have to copy the table from another node in order
> to fix the problem.
>
> Any input appreciated.
>
> We have seen this error in R10-B8 and recently in the latest R11-B2.

The system I've experienced this on was R11B2 also.

Sadly I didn't take a copy of the dets file before repairing it, so
I'm not sure I've got much information that will be useful in tracking
the problem down. If I hit it again I have the option of switching
traffic to another machine while leaving this running - I could
probably arrange a login for the OTP guys if you're interested.

Cheers,
-- 
Geoff Cant




More information about the erlang-questions mailing list