erlang connect with mongodb多线程错误
我使用localhost:270192702027021作为mongodb服务器 当我第一次通过5个线程与它连接时,每个进程读取一个数据。它将抛出异常。如果我使用3或更少的线程,它将是好的 但是,当我成功地通过3个线程连接它时,如果我使用相同的100线程连接进程,它将不再抛出异常,除非我重新连接mongoservererlang connect with mongodb多线程错误,mongodb,erlang,Mongodb,Erlang,我使用localhost:270192702027021作为mongodb服务器 当我第一次通过5个线程与它连接时,每个进程读取一个数据。它将抛出异常。如果我使用3或更少的线程,它将是好的 但是,当我成功地通过3个线程连接它时,如果我使用相同的100线程连接进程,它将不再抛出异常,除非我重新连接mongoserver =ERROR REPORT==== 3-Aug-2013::11:28:37 === ** Generic server <0
=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!!!!!
=错误报告===2013年8月3日::11:28:37===
**通用服务器终止
**最后一条消息是{modify,#Fun}
**当服务器状态=={{dict,3,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[]},
{{[],[],[],
[[{"192.168.17.100",27019}|{}]],
[],
[[{"192.168.17.100",27021}|{}]],
[],[],[],[],[],[],
[[{"192.168.17.100",27020}|{}]],
[],[],[]}}},
#乐趣}
**终止原因==
**{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},
{set,fold_bucket,3},
{set,fold_seg,4},
{set,fold_segs,4},
{mongo_replset'-fetch_member_info/1-fun-3-',3},
{mvar'-modify_/2-fun-0-',2},
{mvar,handle_call,3}]}
Pid{,
{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},
{set,fold_bucket,3},
{set,fold_seg,4},
{set,fold_segs,4},
{mongo_replset'-fetch_member_info/1-fun-3-',3},
{mvar'-modify_/2-fun-0-',2},
{mvar,处理呼叫,3}]}退出!!!!!
您可以在错误日志中看到,该连接存储在进程字典中为{“192.168.17.100”,27019}
。。。
程序在查找{“localhost”,27021}
格式的元组时失败。显然,您的本地主机地址必须是192.168.17.100
,并且在您进行的不同测试之间,您可以直接或不直接调用dict:fetch/2
函数,使用不同形式的本地主机(“localhost”和“192.168.17.100”)