簡體   English   中英

CouchDB / Couchrest Errno :: ECONNREFUSED連接被拒絕-connect(2)錯誤

[英]CouchDB/Couchrest Errno::ECONNREFUSED Connection Refused - connect(2) error

在工作中,我們有大約1500個測試用例,我們使用DB.recreate手動清理數據庫! 每次測試之前的方法。 使用bundle exec rake spec運行所有測試時,所有測試很少通過。 在套件末尾有許多測試失敗,並出現“ Errno :: ECONNREFUSED拒絕連接-connect(2)錯誤”錯誤。

任何幫助將非常感激!

我正在使用CouchDB 1.3.1,Ubuntu 12.04 LTS,Ruby 1.9.3和Rails 3.2.12。

謝謝,

編輯

我更仔細地查看了日志文件,並與測試開始失敗的時間和在ouchdb日志中生成的錯誤消息相匹配。

[Fri, 16 Aug 2013 19:39:46 GMT] [error] [<0.23790.0>] ** Generic server <0.23790.0> terminating 
** Last message in was {'EXIT',<0.23789.0>,killed}
** When Server state == {file,{file_descriptor,prim_file,{#Port<0.14445>,20}},
                              79}
** Reason for termination == 
** killed

[Fri, 16 Aug 2013 19:39:46 GMT] [error] [<0.23790.0>] {error_report,<0.31.0>,
                          {<0.23790.0>,crash_report,
                           [[{initial_call,{couch_file,init,['Argument__1']}},
                             {pid,<0.23790.0>},
                             {registered_name,[]},
                             {error_info,
                                 {exit,killed,
                                     [{gen_server,terminate,6},
                                      {proc_lib,init_p_do_apply,3}]}},
                             {ancestors,[<0.23789.0>]},
                             {messages,[]},
                             {links,[]},
                             {dictionary,[]},
                             {trap_exit,true},
                             {status,running},
                             {heap_size,377},
                             {stack_size,24},
                             {reductions,916}],
                            []]}}
[Fri, 16 Aug 2013 19:39:46 GMT] [error] [<0.23808.0>] {error_report,<0.31.0>,
                       {<0.23808.0>,crash_report,
                        [[{initial_call,
                           {couch_ref_counter,init,['Argument__1']}},
                          {pid,<0.23808.0>},
                          {registered_name,[]},
                          {error_info,
                           {exit,
                            {noproc,
                             [{erlang,link,[<0.23790.0>]},
                              {couch_ref_counter,'-init/1-lc$^0/1-0-',1},
                              {couch_ref_counter,init,1},
                              {gen_server,init_it,6},
                              {proc_lib,init_p_do_apply,3}]},
                            [{gen_server,init_it,6},
                             {proc_lib,init_p_do_apply,3}]}},
                          {ancestors,[<0.23793.0>,<0.23792.0>,<0.23789.0>]},
                          {messages,[]},
                          {links,[]},
                          {dictionary,[]},
                          {trap_exit,false},
                          {status,running},
                          {heap_size,377},
                          {stack_size,24},
                          {reductions,114}],
                         []]}}
[Fri, 16 Aug 2013 19:39:46 GMT] [error] [<0.103.0>] ** Generic server <0.103.0> terminating 
** Last message in was {'EXIT',<0.88.0>,killed}
** When Server state == {db,<0.103.0>,<0.104.0>,nil,<<"1376681645837889">>,
                            <0.106.0>,<0.102.0>,<0.107.0>,
                            {db_header,6,1,0,
                                {1856,{1,0,1777},95},
                                {1951,1,83},
                                nil,0,nil,nil,1000},
                            1,
                            {btree,<0.102.0>,
                                {1856,{1,0,1777},95},
                                #Fun<couch_db_updater.10.55895019>,
                                #Fun<couch_db_updater.11.100913286>,
                                #Fun<couch_btree.5.25288484>,
                                #Fun<couch_db_updater.12.39068440>,snappy},
                            {btree,<0.102.0>,
                                {1951,1,83},
                                #Fun<couch_db_updater.13.114276184>,
                                #Fun<couch_db_updater.14.2340873>,
                                #Fun<couch_btree.5.25288484>,
                                #Fun<couch_db_updater.15.23651859>,snappy},
                            {btree,<0.102.0>,nil,
                                #Fun<couch_btree.3.20686015>,
                                #Fun<couch_btree.4.73514747>,
                                #Fun<couch_btree.5.25288484>,nil,snappy},
                            1,<<"_users">>,"/var/lib/couchdb/_users.couch",
                            [#Fun<couch_doc.8.106888048>],
                            [],nil,
                            {user_ctx,null,[],undefined},
                            nil,1000,
                            [before_header,after_header,on_file_open],
                            [create,
                             {before_doc_update,
                                 #Fun<couch_users_db.before_doc_update.2>},
                             {after_doc_read,
                                 #Fun<couch_users_db.after_doc_read.2>},
                             sys_db,
                             {user_ctx,
                                 {user_ctx,null,[<<"_admin">>],undefined}},
                             nologifmissing,sys_db],
                            snappy,#Fun<couch_users_db.before_doc_update.2>,
                            #Fun<couch_users_db.after_doc_read.2>}
** Reason for termination == 
** killed

啊...社區的力量。 我從CouchDB郵件列表中的某人得到以下答復。

簡而言之,解決方案是將delayed_commit值更改為false 默認情況下將其設置為true ,並在每個測試用例的開頭快速重新創建多個數據庫,以創建競爭條件(刪除不存在的db等)。

這肯定解決了我的問題。

需要注意的是,它使我們的測試時間延長了一倍。 這是另一個要解決的問題,但就目前而言,我對所有通過的測試感到滿意。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM