[JMeter] Can't accept UDP co
2018-12-15 本文已影响101人
Fighting_001
一、问题描述
在Linux服务器(CentOS7系统)中配置并启动JMeter远程监控服务器资源所需的ServerAgent目录下的 startAgent.sh 文件时,系统出现异常提示,如下:
[root@localhost ServerAgent-2.2.3]# ./startAgent.sh
INFO 2018-12-15 10:29:17.634 [kg.apc.p] (): Binding UDP to 4444
ERROR 2018-12-15 10:29:17.686 [kg.apc.p] (): Can't accept UDP connections
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.DatagramChannelImpl.bind(DatagramChannelImpl.java:691)
at sun.nio.ch.DatagramSocketAdaptor.bind(DatagramSocketAdaptor.java:91)
at kg.apc.perfmon.PerfMonWorker.listenUDP(PerfMonWorker.java:144)
at kg.apc.perfmon.PerfMonWorker.startAcceptingCommands(PerfMonWorker.java:107)
at kg.apc.perfmon.AgentTool.processParams(AgentTool.java:72)
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:63)
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
二、问题分析
从以上抛出的异常信息中提取关键的提示信息:
"Can't accept UDP connections
java.net.BindException: Address already in use"
分析:ServerAgent默认开始的是4444端口,提示“不能接收UDP连接,地址已在使用中”,很可能是该端口已被占用,需要修改为新的端口号再启用or先暂停该端口对应的进程,然后再启用ServerAgent服务
三、解决方案
方式1:先暂停4444端口,再启用ServerAgent服务
查询4444端口当前对应的进程:lsof -i:4444
[root@localhost ServerAgent-2.2.3]# lsof -i:4444
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 104069 root 18u IPv6 3997358 0t0 UDP *:krb524
java 104069 root 19u IPv6 3997549 0t0 TCP *:krb524 (LISTEN)
关闭指定PID号码的进程(4444端口进程):kill -9 104069
此时,亦可正常启用ServerAgent服务,如下:
[root@localhost ServerAgent-2.2.3]# kill -9 104069
[root@localhost ServerAgent-2.2.3]# lsof -i:4444
[root@localhost ServerAgent-2.2.3]# ./startAgent.sh
INFO 2018-12-15 10:41:51.043 [kg.apc.p] (): Binding UDP to 4444
INFO 2018-12-15 10:41:52.059 [kg.apc.p] (): Binding TCP to 4444
INFO 2018-12-15 10:41:52.066 [kg.apc.p] (): JP@GC Agent v2.2.3 started
方式2:修改ServerAgent端口,再启用ServerAgent服务
./startAgent.sh –udp-port 0 –tcp-port xxxx ("xxxx" 为新端口号,如:4567)
./startAgent.sh –udp-port 0 –tcp-port 4567