0

当我第一次通过5个线程连接它时,我使用localhost:27019,27020,27021作为mongodb服务器,每个进程读取一个数据。它会抛出异常。如果我使用 3 个或更少的线程,就可以了。

但是当我通过3个线程成功连接它时,如果我通过100个进程使用相同的连接,除非我重新连接mongoserver,否则它不会再抛出异常。

            =ERROR REPORT==== 3-Aug-2013::11:28:37 ===
            ** Generic server <0.164.0> terminating 
            ** Last message in was {modify,#Fun<mvar.2.15158540>}
            ** When Server state == {{dict,3,16,16,8,80,48,
                                           {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],
                                            []},
                                           {{[],[],[],
                                             [[{"192.168.17.100",27019}|{}]],
                                             [],
                                             [[{"192.168.17.100",27021}|{}]],
                                             [],[],[],[],[],[],
                                             [[{"192.168.17.100",27020}|{}]],
                                             [],[],[]}}},
                                     #Fun<mvar.1.22957847>}
            ** Reason for termination == 
            ** {badarg,[{dict,fetch,
                              [{"localhost",27021},
                               {dict,3,16,16,8,80,48,
                                     {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
                                     {{[],[],[],
                                       [[{"192.168.17.100",27019}|{}]],
                                       [],
                                       [[{"192.168.17.100",27021}|{}]],
                                       [],[],[],[],[],[],
                                       [[{"192.168.17.100",27020}|{}]],
                                       [],[],[]}}}]},
                        {mongo_replset,remove_host,2},
                        {sets,fold_bucket,3},
                        {sets,fold_seg,4},
                        {sets,fold_segs,4},
                        {mongo_replset,'-fetch_member_info/1-fun-3-',3},
                        {mvar,'-modify_/2-fun-0-',2},
                        {mvar,handle_call,3}]}
            Pid {<0.88.0>,
                 {badarg,[{dict,fetch,
                                [{"localhost",27021},
                                 {dict,3,16,16,8,80,48,
                                       {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
                                       {{[],[],[],
                                         [[{"192.168.17.100",27019}|{}]],
                                         [],
                                         [[{"192.168.17.100",27021}|{}]],
                                         [],[],[],[],[],[],
                                         [[{"192.168.17.100",27020}|{}]],
                                         [],[],[]}}}]},
                          {mongo_replset,remove_host,2},
                          {sets,fold_bucket,3},
                          {sets,fold_seg,4},
                          {sets,fold_segs,4},
                          {mongo_replset,'-fetch_member_info/1-fun-3-',3},
                          {mvar,'-modify_/2-fun-0-',2},
                          {mvar,handle_call,3}]}} Exit!!!!!
4

1 回答 1

1

您可以在错误日志中看到连接在进程字典中存储为{"192.168.17.100",27019}... 并且程序在查找表单的元组时失败{"localhost",27021}。显然,您的本地主机地址必须是192.168.17.100,并且在您进行的不同测试之间,您直接或不直接调用dict:fetch/2具有不同本地主机形式(“localhost”和“192.168.17.100”)的函数。

于 2013-08-04T08:54:19.830 回答