分类: 服务器与存储
2014-05-07 19:08:03
badmatch,{error,duplicate_name}的解决方案
在用tsung进行压力测试时,碰到如下问题:
[root@tixa .tsung]# tsung start
Starting Tsung
{error_logger,{{2014,5,7},{18,17,46}},"Protocol: ~p: register error: ~p~n",["inet_tcp",{{badmatch,{error,duplicate_name}},[{inet_tcp_dist,listen,1,[{file,"inet_tcp_dist.erl"},{line,70}]},{net_kernel,start_protos,4,[{file,"net_kernel.erl"},{line,1314}]},{net_kernel,start_protos,3,[{file,"net_kernel.erl"},{line,1307}]},{net_kernel,init_node,2,[{file,"net_kernel.erl"},{line,1197}]},{net_kernel,init,1,[{file,"net_kernel.erl"},{line,357}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}]}
{error_logger,{{2014,5,7},{18,17,46}},crash_report,[[{initial_call,{net_kernel,init,['Argument__1']}},{pid,<0.21.0>},{registered_name,[]},{error_info,{exit,{error,badarg},[{gen_server,init_it,6,[{file,"gen_server.erl"},{line,320}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}},{ancestors,[net_sup,kernel_sup,<0.10.0>]},{messages,[]},{links,[#Port<0.152>,<0.18.0>]},{dictionary,[{longnames,false}]},{trap_exit,true},{status,running},{heap_size,987},{stack_size,24},{reductions,792}],[]]}
{error_logger,{{2014,5,7},{18,17,46}},supervisor_report,[{supervisor,{local,net_sup}},{errorContext,start_error},{reason,{'EXIT',nodistribution}},{offender,[{pid,undefined},{name,net_kernel},{mfargs,{net_kernel,start_link,[[tsung_controller,shortnames]]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]}
{error_logger,{{2014,5,7},{18,17,46}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,shutdown},{offender,[{pid,undefined},{name,net_sup},{mfargs,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]}
{error_logger,{{2014,5,7},{18,17,46}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]}
{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}"}
Crash dump was written to: erl_crash.dump
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}})
原因:前一个进程因为意外而没有关闭。
解决方案:杀掉原来的进程。
[root@tixa .tsung]# ps aux | grep erlang
root 5547 0.0 0.0 1900 520 ? S 16:37 0:00 /usr/local/lib/erlang/erts-5.9.1/bin/epmd -daemon
root 5824 3.9 1.5 92388 32276 ? Sl 16:49 3:30 /usr/local/lib/erlang/erts-5.9.1/bin/beam.smp -P 250000 -A 16 -K true -- -root /usr/local/lib/erlang -progname erl -- -home /root -- -kernel inet_dist_listen_min 64000 -kernel inet_dist_listen_max 65500 -smp auto -rsh ssh -noshell -proto_dist inet_tcp -sname tsung_controller -setcookie tsung -boot /usr/local/lib/erlang//lib/tsung_controller-1.4.2/priv/tsung_controller -boot_var TSUNGPATH /usr/local/lib/erlang/ -pa /usr/local/lib/erlang//lib/tsung-1.4.2/ebin -pa /usr/local/lib/erlang//lib/tsung_controller-1.4.2/ebin -tsung_controller smp_disable true -tsung_controller debug_level 5 -tsung_controller warm_time 10 -tsung_controller config_file "/root/.tsung/tsung.xml" -tsung_controller log_dir "/root/.tsung/log/" -tsung_controller mon_file "tsung.log"
root 5888 24.1 8.0 187352 167260 ? Sl 16:49 21:39 /usr/local/lib/erlang/erts-5.9.1/bin/beam -A 16 -P 250000 -K true -- -root /usr/local/lib/erlang -progname erl -- -home /root -- -noshell -noinput -noshell -noinput -master tsung_controller@tixa -sname tsung0@host142 -s slave slave_start tsung_controller@tixa slave_waiter_0 -rsh ssh -noshell -noinput -setcookie tsung -smp disable -kernel inet_dist_listen_min 64000 -kernel inet_dist_listen_max 65500 -boot /usr/local/lib/erlang//lib/tsung-1.4.2/priv/tsung -boot_var TSUNGPATH /usr/local/lib/erlang/ -pa /usr/local/lib/erlang//lib/tsung-1.4.2/ebin -pa /usr/local/lib/erlang//lib/tsung_controller-1.4.2/ebin -tsung debug_level 5 -tsung log_file ts_encoded_47root_47_46tsung_47log_4720140507_451649
root 9955 0.0 0.0 3924 684 pts/2 S+ 18:18 0:00 grep erlang
[root@tixa .tsung]#
[root@tixa .tsung]#
[root@tixa .tsung]# kill -9 5824
重新运行tsung start ,终于看到输出到日志文件!