我在 docker 容器中运行 ejabberd。很长一段时间内一切正常,但今天我发现一个小时左右后 ejabberd 崩溃了。这是 crash.log 文件的重要部分。
/var/log/ejabberd/crash.log
--------------------------------------------------------------------------------
2016-12-27 16:00:25 =CRASH REPORT====
crasher:
initial call: disk_log:init/2
pid: <0.169.0>
registered_name: []
exception exit: {{{failed,{error,{file_error,"/opt/ejabberd/database/ejabberd@localhost/PREVIOUS.LOG",enoent}}},[{disk_log,reopen,2}]},[{disk_log,do_exit,4,[{file,"disk_log.erl"},{line,1188}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]}
ancestors: [disk_log_sup,kernel_safe_sup,kernel_sup,<0.10.0>]
messages: []
links: [<0.135.0>]
dictionary: []
trap_exit: true
status: running
heap_size: 2586
stack_size: 27
reductions: 40032
neighbours:
2016-12-27 16:00:25 =SUPERVISOR REPORT====
Supervisor: {local,disk_log_sup}
Context: child_terminated
Reason: {{failed,{error,{file_error,"/opt/ejabberd/database/ejabberd@localhost/PREVIOUS.LOG",enoent}}},[{disk_log,reopen,2}]}
Offender: [{pid,<0.169.0>},{name,disk_log},{mfargs,{disk_log,istart_link,undefined}},{restart_type,temporary},{shutdown,1000},{child_type,worker}]
2016-12-27 16:00:25 =ERROR REPORT====
** gen_event handler mnesia_event crashed.
** Was installed in mnesia_event
** Last event was: {mnesia_system_event,{mnesia_fatal,"~p~n",[{error,{"Cannot rename disk_log file",latest_log,"/opt/ejabberd/database/ejabberd@localhost/PREVIOUS.LOG",{log_header,trans_log,"4.3","4.12.3",ejabberd@localhost,{1482,854424,897044}},{file_error,"/opt/ejabberd/database/ejabberd@localhost/PREVIOUS.LOG",enoent}}}],<<131,108,0,0,0,24,104,2,100,0,9,99,114,97,115,104,105,110,102,111,104,2,107,0,4,126,112,126,110,108,0,0,0,1,104,2,
......
基于崩溃错误日志似乎与日志轮换有关。
Cannot rename disk_log file",latest_log,"/opt/ejabberd/database/ejabberd@localhost/PREVIOUS.LOG
奇怪的是,每当我重新启动容器时一切正常,我显然可以看到/opt/ejabberd/database/ejabberd@localhost/
包含所有文件的目录以及LATEST.LOG
文件。一个小时左右后,它崩溃了,然后里面的所有东西/opt/ejabberd/database/ejabberd@localhost/
都消失了,即使ejabberd@localhost
目录也被删除了。
如果我进入容器内部,我将无法再次创建目录或目录中的任何其他文件/opt/ejabberd/database/
。
$mkdir -p /opt/ejabberd/database/ejabberd@localhost
mkdir: cannot create directory ‘/opt/ejabberd/database/ejabberd@localhost’: No such file or directory
似乎不是权限问题
$ls -lh /opt/ejabberd/
drwxr-xr-x 0 ejabberd ejabberd 0 Dec 27 15:09 backup
drwxr-xr-x 2 ejabberd ejabberd 4.0K Dec 27 15:09 conf
drwxr-xr-x 0 ejabberd ejabberd 0 Dec 27 16:00 database
drwxr-xr-x 5 ejabberd ejabberd 4.0K Dec 27 15:09 extauth
-rw-r--r-- 1 ejabberd ejabberd 0 Dec 27 15:09 first-start-done
-rwxr-xr-x 1 ejabberd ejabberd 747 Mar 2 2016 init.sh
drwxr-xr-x 15 ejabberd ejabberd 4.0K Jul 15 08:59 scripts
drwxr-xr-x 0 ejabberd ejabberd 0 Dec 27 16:00 ssl
drwxr-xr-x 0 ejabberd ejabberd 0 Dec 27 15:09 upload
不得不说我以前没有这个,有没有人在使用 ejabberd 的 docker 容器中经历过类似的事情?有什么想法会导致这个奇怪的错误吗?
提前致谢