【Furion】执行的csv文件未找到
发布日期:2021-06-30 21:35:43 浏览次数:4 分类:技术文章

本文共 2611 字,大约阅读时间需要 8 分钟。

在furion平台启动性能测试任务时,20台肉鸡,每台肉鸡1000个并发线程,但是实际日志收集到到信息仅仅1000个线程,查看肉鸡的日志:

在这里插入图片描述

问题定位

  1. 查看对应路径的文件
    在这里插入图片描述
  2. 很明显该文件存在,打开文件,文件内容正常
    在这里插入图片描述
  3. 还是看看具体的报错信息吧,定位到具体的代码段信息
/**     * Creates an association between a filename and a File inputOutputObject,     * and stores it for later use - unless it is already stored.     *     * @param filename - relative (to base) or absolute file name (must not be null or empty)     * @param charsetName - the character set encoding to use for the file (may be null)     * @param alias - the name to be used to access the object (must not be null)     * @param hasHeader true if the file has a header line describing the contents     * @return the header line; may be null     * @throws IllegalArgumentException if header could not be read or filename is null or empty     */    public synchronized String reserveFile(String filename, String charsetName, String alias, boolean hasHeader) {
if (filename == null || filename.isEmpty()){
throw new IllegalArgumentException("Filename must not be null or empty"); } if (alias == null){
throw new IllegalArgumentException("Alias must not be null"); } FileEntry fileEntry = files.get(alias); if (fileEntry == null) {
fileEntry = new FileEntry(resolveFileFromPath(filename), null, charsetName); if (filename.equals(alias)){
log.info("Stored: {}", filename); } else {
log.info("Stored: {} Alias: {}", filename, alias); } files.put(alias, fileEntry); if (hasHeader) {
try {
fileEntry.headerLine = readLine(alias, false); if (fileEntry.headerLine == null) {
fileEntry.exception = new EOFException("File is empty: " + fileEntry.file); } } catch (IOException | IllegalArgumentException e) {
fileEntry.exception = e; } } } if (hasHeader && fileEntry.headerLine == null) {
throw new IllegalArgumentException("Could not read file header line for file " + filename, fileEntry.exception); } return fileEntry.headerLine; }

从代码中读取文件fileEntry.headerLine = readLine(alias, false); ,找不到文件时异常处理 fileEntry.exception = e; ,将异常赋值给fileEntry.exception

从代码上看问题出现在赋值这里,因为第一次读取这个文件异常后,后续即使有这个文件存在但仍会上抛这个异常导致

ps:在一开始的现象中,仅仅有一台肉鸡可以正常运行,因为第一次同步csv文件时仅仅同步给了那一台肉鸡且运行

解决方案

  1. 修改jmeter源码修复这个问题,去掉异常赋值等方式
  2. 从源码中可以看到 hasHeader 也是其中一个判断因素,在jmeter的脚本jmx文件中,可以将该属性配置为False
    在这里插入图片描述
    根据方案2修改后再次执行,果然解决问题

转载地址:https://lluozh.blog.csdn.net/article/details/108747379 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:【调优案例】druid testOnBorrow参数问题
下一篇:【接口平台】测试计划执行效率优化

发表评论

最新留言

关注你微信了!
[***.104.42.241]2024年04月07日 16时42分53秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章