Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mnesia crash #619

Closed
chuanjian666 opened this issue Sep 29, 2015 · 3 comments
Closed

Mnesia crash #619

chuanjian666 opened this issue Sep 29, 2015 · 3 comments

Comments

@chuanjian666
Copy link

Our login server based on cb, we use mnesia, we meet one problem, below is error log

2015-09-29 11:12:18.577 [error] <0.117.0> CRASH REPORT Process <0.117.0> with 0 neighbours exited with reason: {failed,{error,{file_error,"/home/longtu/ErlServer/gateway/mnesia/PREVIOUS.LOG",enoent}}} in disk_log:reopen/2 in disk_log:do_exit/4 line 1188
2015-09-29 11:12:18.578 [error] <0.105.0> Supervisor disk_log_sup had child disk_log started with {disk_log,istart_link,undefined} at <0.117.0> exit with reason {failed,{error,{file_error,"/home/longtu/ErlServer/gateway/mnesia/PREVIOUS.LOG",enoent}}} in disk_log:reopen/2 in context child_terminated
2015-09-29 11:12:18.637 [error] <0.93.0> Mnesia('master@192.168.80.102'): ** ERROR ** (core dumped to file: "/home/longtu/ErlServer/gateway/MnesiaCore.master@192.168.80.102_1443_496338_616843")
 ** FATAL ** {error,{"Cannot rename disk_log file",latest_log,"/home/longtu/ErlServer/gateway/mnesia/PREVIOUS.LOG",{log_header,trans_log,"4.3","4.12.4",'master@192.168.80.102',{1443,496338,568410}},{file_error,"/home/longtu/ErlServer/gateway/mnesia/PREVIOUS.LOG",enoent}}}

2015-09-29 11:12:28.617 [error] <0.93.0> Mnesia('master@192.168.80.102'): ** ERROR ** mnesia_event got unexpected event: {'EXIT',<0.96.0>,killed}

2015-09-29 11:12:28.617 [error] <0.93.0> CRASH REPORT Process mnesia_event with 0 neighbours exited with reason: killed in gen_event:terminate_server/4 line 302
2015-09-29 11:12:28.618 [error] <0.90.0> CRASH REPORT Process <0.90.0> with 0 neighbours exited with reason: killed in application_master:terminate/2 line 227
2015-09-29 11:13:30.141 [error] <0.205.0> gen_server lib_game terminated with reason: {aborted,{no_exists,[server,1]}} in mnesia:abort/1 line 310
2015-09-29 11:13:30.142 [error] <0.205.0> CRASH REPORT Process lib_game with 0 neighbours exited with reason: {aborted,{no_exists,[server,1]}} in gen_server:terminate/7 line 804
2015-09-29 11:13:30.142 [error] <0.55.0> Supervisor boss_sup had child lib_game started with lib_game:start_link() at <0.205.0> exit with reason {aborted,{no_exists,[server,1]}} in context child_terminated
2015-09-29 11:33:00.768 [error] <0.147.0> gen_server <0.147.0> terminated with reason: {aborted,{no_exists,account,attributes}} in mnesia:abort/1 line 310
2015-09-29 11:33:00.768 [error] <0.147.0> CRASH REPORT Process <0.147.0> with 0 neighbours exited with reason: {aborted,{no_exists,account,attributes}} in gen_server:terminate/7 line 804
2015-09-29 11:33:00.768 [error] <0.142.0> Supervisor {<0.142.0>,poolboy_sup} had child boss_db_controller started with {boss_db_controller,start_link,undefined} at <0.147.0> exit with reason {aborted,{no_exists,account,attributes}} in context child_terminated

Anybody meet this problem?

Similar prolem in RabbitMQ:

http://comments.gmane.org/gmane.comp.networking.rabbitmq.general/28794

http://comments.gmane.org/gmane.comp.networking.rabbitmq.general/21366

@chuanjian666
Copy link
Author

I think the key of this problem is when rename LATEST.LOG to PREVIOUS.LOG, PREVIOUS.LOG is not exist and then we get a error enoent.

By reading the mnesia docs, some instructions about log file:

Log File

When starting Mnesia, a .LOG file called LATEST.LOG is created and placed in the database directory. This file is used by Mnesia to log disc-based transactions. This includes all transactions that write at least one record in a table that is of storage type disc_copies or disc_only_copies. The file also includes all operations that manipulate the schema itself, such as creating new tables. The log format can vary with different implementations of Mnesia. The Mnesia log is currently implemented in the standard library module disk_log in Kernel.

The log file grows continuously and must be dumped at regular intervals. "Dumping the log file" means that Mnesia performs all the operations listed in the log and place the records in the corresponding .DAT, .DCD, and .DCL data files. For example, if the operation "write record {foo, 4, elvis, 6}" is listed in the log, Mnesia inserts the operation into the file foo.DCL. Later, when Mnesia thinks that the .DCL file is too large, the data is moved to the .DCD file. The dumping operation can be time consuming if the log is large. Notice that the Mnesia system continues to operate during log dumps.

By default Mnesia either dumps the log whenever 100 records have been written in the log or when three minutes have passed. This is controlled by the two application parameters -mnesia dump_log_write_threshold WriteOperations and -mnesia dump_log_time_threshold MilliSecs.

Before the log is dumped, the file LATEST.LOG is renamed to PREVIOUS.LOG, and a new LATEST.LOG file is created. Once the log has been successfully dumped, the file PREVIOUS.LOG is deleted.

The log is also dumped at startup and whenever a schema operation is performed.

So, I think PREVIOUS.LOG is a tmp file, why need it exist?

@mihawk
Copy link
Contributor

mihawk commented Oct 12, 2015

i think you better ask on erlang mailling list, you will have better answer.

@danikp
Copy link
Contributor

danikp commented Nov 6, 2015

it's not a CB issue, so it's better to follow @mihawk's advice

@danikp danikp closed this as completed Nov 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants