1. 非GUI页面脚本报错:non http response code: java.net.noroutetohostexception/non http response message: cannot assign requested address (address not available)
执行机端口号占用
1、先检查下tcp port range 是否在合理范围内
[root@VM-85-168-centos ~]# cat /proc/sys/net/ipv4/ip_local_port_range
32768 60999
合理范围中,无需修改
2、调低端口释放后的等待时间, 默认为60s, 修改为15~30s
echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout
3、修改tcp/ip协议配置, 通过配置/proc/sys/net/ipv4/tcp_tw_resue, 默认为0, 修改为1, 释放TIME_WAIT端口给新连接使用
echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
4、修改tcp/ip协议配置,快速回收socket资源, 默认为0, 修改为1
echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
5、执行命令使设置立即生效
sysctl -p
2. 执行机启动脚本报错内存不足
- 查看对应log文件,提示内存和swap不足
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 8589934592 bytes for committing reserved memory.
# Possible reasons:
# The system is out of physical RAM or swap space
# The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
# Out of Memory Error (os_linux.cpp:2791), pid=4074, tid=0x00007f784019a700
#
# JRE version: (8.0_402-b06) (build )
# Java VM: OpenJDK 64-Bit Server VM (25.402-b06 mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
- 通过top命令和free命令查看,未使用swap,内存看起来也还有剩余
- 查看运行的进程:ps -ef,有一些jmeter进程占用内存
- 原因,jmeter运行过程中使用ctrl+z暂停的运行进程,应使用ctrl+c结束进程