【问题标题】:Couchdb view query crash/time outCouchdb 查看查询崩溃/超时
【发布时间】:2016-03-30 16:07:28
【问题描述】:

我在 debian 8 64 位实例上设置了 couchdb。

当我查询其中一个视图时,从 curl 的角度来看,它会超时。

以下是我从 couch.log 中看到的内容:

[Thu, 24 Dec 2015 07:17:23 GMT] [info] [<0.173.0>] Starting index update for db: notes idx: _design/notes
[Thu, 24 Dec 2015 07:17:23 GMT] [error] [<0.180.0>] ** Generic server <0.180.0> terminating
** Last message in was {prompt,[<<"reset">>,
                                {[{<<"reduce_limit">>,true},
                                  {<<"timeout">>,5000}]}]}
** When Server state == {os_proc,"/usr/local/bin/couchjs /usr/local/share/couchdb/server/main.js",
                                 #Port<0.2840>,
                                 #Fun<couch_os_process.2.3888802>,
                                 #Fun<couch_os_process.3.3888802>,5000}
** Reason for termination ==
** {badarg,[{erlang,port_command,
                    [#Port<0.2840>,
                     [<<"[\"reset\",{\"reduce_limit\":true,\"timeout\":5000}]">>,
                      10]],
                    []},
            {couch_os_process,writejson,2,
                              [{file,"couch_os_process.erl"},{line,93}]},
            {couch_os_process,handle_call,3,
                              [{file,"couch_os_process.erl"},{line,183}]},
            {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,580}]},
            {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]}

[Thu, 24 Dec 2015 07:17:23 GMT] [error] [<0.180.0>] {error_report,<0.31.0>,
                     {<0.180.0>,crash_report,
                      [[{initial_call,{couch_os_process,init,['Argument__1']}},
                        {pid,<0.180.0>},
                        {registered_name,[]},
                        {error_info,
                         {exit,
                          {badarg,
                           [{erlang,port_command,
                             [#Port<0.2840>,
                              [<<"[\"reset\",{\"reduce_limit\":true,\"timeout\":5000}]">>,
                               10]],
                             []},
                            {couch_os_process,writejson,2,
                             [{file,"couch_os_process.erl"},{line,93}]},
                            {couch_os_process,handle_call,3,
                             [{file,"couch_os_process.erl"},{line,183}]},
                            {gen_server,handle_msg,5,
                             [{file,"gen_server.erl"},{line,580}]},
                            {proc_lib,init_p_do_apply,3,
                             [{file,"proc_lib.erl"},{line,237}]}]},
                          [{gen_server,terminate,6,
                            [{file,"gen_server.erl"},{line,737}]},
                           {proc_lib,init_p_do_apply,3,
                            [{file,"proc_lib.erl"},{line,237}]}]}},
                        {ancestors,
                         [couch_query_servers,couch_secondary_services,
                          couch_server_sup,<0.32.0>]},
                        {messages,[{#Port<0.2840>,{exit_status,127}}]},
                        {links,[<0.95.0>]},

一些沙发专家可以帮我解决这个问题吗?

【问题讨论】:

    标签: erlang debian couchdb


    【解决方案1】:

    请注意,如果 reduce 函数的结果比初始值列表长,则会引发查询服务器错误。但是,可以通过将 reduce_limit 配置选项设置为 false 来禁用此行为

    http://docs.couchdb.org/en/latest/couchapp/ddocs.html

    在页面中搜索出现的reduce_limit。

    【讨论】:

    • 稍微扩展一下这个答案:错误说的是你有一个 reduce 函数,它实际上并没有使数据变小。是的,您可以禁用安全检查,但您最终可能会得到一个非常低效的索引。我建议 OP 提出一个新问题,关于 为什么 reduce 函数会导致此错误以及如何为所需的查询类型设计更有效的索引。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-09
    • 2010-12-01
    • 1970-01-01
    • 2015-11-16
    • 2014-02-27
    • 1970-01-01
    相关资源
    最近更新 更多