CouchDB突然因“无法打开文件”错误而崩溃

时间:2015-08-20 15:20:12

标签: couchdb

专家,

我的couchDB安装遇到了一个令人惊讶的问题:从一个时刻到另一个时刻,没有任何请求可能,并且couchDB不再运行。

查看错误日志显示以下堆栈跟踪(这些是第一个,非常类似的跟随)。提到的db-files确实存在于指定的目录中,并具有正确的访问权限(couchdb:couchdb,640)。

系统是FreeBSD 10.1-RELEASE-p16,couchdb 1.6.1

[Thu, 20 Aug 2015 13:37:29 GMT] [error] [<0.28818.72>] Could not open file /var/db/couchdb/db1/abc.couch: no such file or directory
[Thu, 20 Aug 2015 13:37:29 GMT] [error] [<0.25245.72>] Could not open file /var/db/couchdb/db1/abc.couch: no such file or directory
[Thu, 20 Aug 2015 13:50:45 GMT] [error] [<0.13142.73>] Could not open file /var/db/couchdb/db1/def.couch: no such file or directory
[Thu, 20 Aug 2015 13:52:29 GMT] [error] [<0.15770.73>] Could not open file /var/db/couchdb/db1/abc.couch: no such file or directory
[Thu, 20 Aug 2015 13:52:29 GMT] [error] [<0.17891.73>] Could not open file /var/db/couchdb/db1/abc.couch: no such file or directory
[Thu, 20 Aug 2015 13:59:47 GMT] [error] [<0.23972.73>] {error_report,<0.31.0>,
                        {<0.23972.73>,crash_report,
                         [[{initial_call,{couch_file,init,['Argument__1']}},
                           {pid,<0.23972.73>},
                           {registered_name,[]},
                           {error_info,
                            {exit,
                             {{badmatch,{error,eacces}},
                              [{couch_file,init,1,
                                [{file,"couch_file.erl"},{line,314}]},
                               {gen_server,init_it,6,
                                [{file,"gen_server.erl"},{line,328}]},
                               {proc_lib,init_p_do_apply,3,
                                [{file,"proc_lib.erl"},{line,239}]}]},
                             [{gen_server,init_it,6,
                               [{file,"gen_server.erl"},{line,352}]},
                              {proc_lib,init_p_do_apply,3,
                               [{file,"proc_lib.erl"},{line,239}]}]}},
                           {ancestors,[<0.25603.73>]},
                           {messages,[]},
                           {links,[#Port<0.1119512>,<0.25603.73>]},
                           {dictionary,[]},
                           {trap_exit,true},
                           {status,running},
                           {heap_size,376},
                           {stack_size,27},
                           {reductions,564}],
                          [{neighbour,
                            [{pid,<0.25603.73>},
                             {registered_name,[]},
                             {initial_call,{erlang,apply,2}},
                             {current_function,{gen,do_call,4}},
                             {ancestors,[]},
                             {messages,[]},
                             {links,[<0.85.0>,<0.23972.73>]},
                             {dictionary,[]},
                             {trap_exit,false},
                             {status,waiting},
                             {heap_size,610},
                             {stack_size,16},
                             {reductions,61}]}]]}}
[Thu, 20 Aug 2015 13:59:47 GMT] [error] [<0.23088.73>] httpd 500 error response:
 {"error":"error","reason":"{{badmatch,{error,eacces}},\n [{couch_file,init,1,[{file,\"couch_file.erl\"},{line,314}]},\n  {gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,328}]},\n  {proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,239}]}]}"}

[Thu, 20 Aug 2015 13:59:47 GMT] [error] [<0.26398.73>] {error_report,<0.31.0>,
                        {<0.26398.73>,crash_report,
                         [[{initial_call,{couch_file,init,['Argument__1']}},
                           {pid,<0.26398.73>},
                           {registered_name,[]},
                           {error_info,
                            {exit,
                             {{badmatch,{error,eacces}},
                              [{couch_file,init,1,
                                [{file,"couch_file.erl"},{line,314}]},
                               {gen_server,init_it,6,
                                [{file,"gen_server.erl"},{line,328}]},
                               {proc_lib,init_p_do_apply,3,
                                [{file,"proc_lib.erl"},{line,239}]}]},
                             [{gen_server,init_it,6,
                               [{file,"gen_server.erl"},{line,352}]},
                              {proc_lib,init_p_do_apply,3,
                               [{file,"proc_lib.erl"},{line,239}]}]}},
                           {ancestors,[<0.15629.73>]},
                           {messages,[]},
                           {links,[#Port<0.1119284>,<0.15629.73>]},
                           {dictionary,[]},
                           {trap_exit,true},
                           {status,running},
                           {heap_size,610},
                           {stack_size,27},
                           {reductions,573}],
                          [{neighbour,
                            [{pid,<0.15629.73>},
                             {registered_name,[]},
                             {initial_call,{erlang,apply,2}},
                             {current_function,{proc_lib,sync_wait,2}},
                             {ancestors,[]},
                             {messages,
                              [{ack,<0.26398.73>,
                                {error,
                                 {{badmatch,{error,eacces}},
                                  [{couch_file,init,1,
                                    [{file,"couch_file.erl"},{line,314}]},
                                   {gen_server,init_it,6,
                                    [{file,"gen_server.erl"},{line,328}]},
                                   {proc_lib,init_p_do_apply,3,
                                    [{file,"proc_lib.erl"},{line,239}]}]}}}]},
                             {links,[<0.85.0>,<0.26398.73>]},
                             {dictionary,[]},
                             {trap_exit,false},
                             {status,runnable},
                             {heap_size,233},
                             {stack_size,20},
                             {reductions,28}]}]]}}
[Thu, 20 Aug 2015 13:59:47 GMT] [error] [<0.85.0>] ** Generic server couch_server terminating 
** Last message in was {'EXIT',<0.25603.73>,
                           {{badmatch,{error,eacces}},
                            [{couch_file,init,1,
                                 [{file,"couch_file.erl"},{line,314}]},
                             {gen_server,init_it,6,
                                 [{file,"gen_server.erl"},{line,328}]},
                             {proc_lib,init_p_do_apply,3,
                                 [{file,"proc_lib.erl"},{line,239}]}]}}
** When Server state == {server,"/var/db/couchdb",
                            {re_pattern,0,0,0,
                                <<69,82,67,80,140,0,0,0,16,0,0,0,1,0,0,0,255,
                                  255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,
                                  0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
                                  0,0,0,0,0,0,0,0,0,0,0,125,0,72,25,106,0,0,0,
                                  0,0,0,0,0,0,0,0,0,254,255,255,7,0,0,0,0,0,0,
                                  0,0,0,0,0,0,0,0,0,0,106,0,0,0,0,16,171,255,
                                  3,0,0,0,128,254,255,255,7,0,0,0,0,0,0,0,0,0,
                                  0,0,0,0,0,0,0,98,27,114,0,72,0>>},
                            100,99,"Wed, 19 Aug 2015 12:57:47 GMT"}
** Reason for termination == 
** {{case_clause,[]},
    [{couch_server,handle_info,2,[{file,"couch_server.erl"},{line,435}]},
     {gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,615}]},
     {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,681}]},
     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}

因为我对erlang没有任何线索,所以我不明白一句话 - 这些错误意味着什么,可能产生什么呢?

非常感谢, 塞巴斯蒂安

2 个答案:

答案 0 :(得分:1)

唯一相关的错误是{badmatch,{error,eacces},它表明发生了POSIX EACCES错误。输出的其余部分是显示&#34;状态&#34;的二郎方式。在崩溃周围,并行运行时需要的东西。

根据erlang文档(http://www.erlang.org/doc/man/file.html),错误eacces也可能意味着:&#34;缺少读取文件或搜索其中一个父目录的权限。&#34 ;

您是否还检查了正确的父目录权限? 有没有改变文件系统的东西? /var/db是NFS挂载还是什么?

答案 1 :(得分:1)

该错误告诉您无权访问该文件。可能是文件不存在,或者您无权访问具有couchdb使用的用户标识的某些子目录。

您可以尝试使用su然后touch数据库文件切换到couchdb用户,以检查您到目前为止是否真的有权访问该文件。