Jenkins性能插件出现意外的java.io.FileNotFoundException错误

thtygnil  于 2023-06-21  发布在  Jenkins
关注(0)|答案(2)|浏览(571)

在版本为2.263.3的Jenkins服务器上安装了性能插件,通过Pipeline运行jmeter性能测试作业,一切都按预期工作。作业以“成功”状态完成。
但大约40分钟后,控制台返回消息恢复构建。它返回了FileNotFoundException。每次作业运行时都发生此问题。我们在谷歌上搜索了一些解决方案,仍然没有运气。任何人都可以在这个问题上提供帮助。太谢谢你了

Archiving artifacts
[Pipeline] stage
[Pipeline] { (Generate Test Report)
[Pipeline] perfReport
Creating parser with percentiles:'0,50,90,100,' filterRegex:null
Performance: Recording JMeterCsv reports 'Belong_Jenkins_PerformanceTest/outputFolder/performanceTestResult.jtl'
Performance: JMeterCsv copying reports to master, files '[/home/jenkins/agent/workspace/Belong_Digital_Test/PerformanceTest/Belong_Jenkins_PerformanceTest/outputFolder/performanceTestResult.jtl]'
Performance: JMeterCsv parsing local reports '[/var/jenkins_home/jobs/Belong_Digital_Test/jobs/PerformanceTest/builds/72/performance-reports/JMeterCSV/performanceTestResult.jtl]'
Performance: Parsing report file '/var/jenkins_home/jobs/Belong_Digital_Test/jobs/PerformanceTest/builds/72/performance-reports/JMeterCSV/performanceTestResult.jtl' with filterRegex 'null'.
Performance: No threshold configured for making the test unstable
Performance: No threshold configured for making the test failure
Performance: File performanceTestResult.jtl reported 0.036% of errors [SUCCESS]. Build status is: SUCCESS
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] End of Pipeline
Finished: SUCCESS

Resuming build at Sun May 02 04:31:06 UTC 2021 after Jenkins restart
[Pipeline] End of Pipeline
java.io.FileNotFoundException: /var/jenkins_home/jobs/Belong_Digital_Test/jobs/PerformanceTest/builds/72/program.dat (No such file or directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverReader.openStreamAt(RiverReader.java:188)
    at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverReader.restorePickles(RiverReader.java:136)
    at 

    org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.loadProgramAsync(CpsFlowExecution.java:784)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.onLoad(CpsFlowExecution.java:750)
        at org.jenkinsci.plugins.workflow.job.WorkflowRun.getExecution(WorkflowRun.java:691)
        at org.jenkinsci.plugins.workflow.job.WorkflowRun.onLoad(WorkflowRun.java:550)
        at hudson.model.RunMap.retrieve(RunMap.java:225)
        at hudson.model.RunMap.retrieve(RunMap.java:57)
        at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:501)
        at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:483)
        at jenkins.model.lazy.AbstractLazyLoadRunMap.getByNumber(AbstractLazyLoadRunMap.java:381)
        at jenkins.model.lazy.AbstractLazyLoadRunMap.search(AbstractLazyLoadRunMap.java:346)
        at jenkins.model.lazy.AbstractLazyLoadRunMap.newestBuild(AbstractLazyLoadRunMap.java:276)
        at jenkins.model.lazy.LazyBuildMixIn.getLastBuild(LazyBuildMixIn.java:242)
        at org.jenkinsci.plugins.workflow.job.WorkflowJob.getLastBuild(WorkflowJob.java:240)
        at org.jenkinsci.plugins.workflow.job.WorkflowJob.getLastBuild(WorkflowJob.java:103)
        at org.jenkinsci.plugins.prometheus.JobCollector.appendJobMetrics(JobCollector.java:241)
        at org.jenkinsci.plugins.prometheus.JobCollector.lambda$collect$0(JobCollector.java:196)
        at org.jenkinsci.plugins.prometheus.util.Jobs.forEachJob(Jobs.java:14)
        at org.jenkinsci.plugins.prometheus.JobCollector.collect(JobCollector.java:189)
        at io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.findNextElement(CollectorRegistry.java:190)
        at io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.nextElement(CollectorRegistry.java:223)
        at io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.nextElement(CollectorRegistry.java:144)
        at io.prometheus.client.exporter.common.TextFormat.write004(TextFormat.java:22)
        at org.jenkinsci.plugins.prometheus.service.DefaultPrometheusMetrics.collectMetrics(DefaultPrometheusMetrics.java:54)
        at org.jenkinsci.plugins.prometheus.service.PrometheusAsyncWorker.execute(PrometheusAsyncWorker.java:41)
        at hudson.model.AsyncPeriodicWork.lambda$doRun$0(AsyncPeriodicWork.java:100)
    Caused: java.io.IOException: Failed to load build state
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$3.onSuccess(CpsFlowExecution.java:865)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$3.onSuccess(CpsFlowExecution.java:863)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$4$1.run(CpsFlowExecution.java:917)
        at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:38)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:136)
        at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
        at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
    Finished: FAILURE
qxsslcnc

qxsslcnc1#

经过两年的研究,我终于找到了问题的根源,并提出了解决方案。最初,我的Jenkins作业使用了一个带有K8S pod(容器)堆栈的管道。在成功完成作业后,容器(容器)将被终止。然而,Jenkins错误地将删除事件解释为重新启动,并试图恢复构建。因此,它试图访问原始容器(pod)中的program.dat文件,该文件在作业完成后已经被删除。要解决此问题,一个简单的解决方案是在作业配置中启用选项“如果控制器重新启动,则不允许管道恢复”。不幸的是,这种方法存在一个小缺点,因为作业状态永远显示“失败”,即使它是成功的。

7vhp5slm

7vhp5slm2#

没有足够的数据来分析问题的根本原因,第一行告诉Jenkins在JMeter作业执行期间已经重新启动所以我不会相信任何情况下的测试结果,只要重新运行作业,假设您的配置正确,您应该会看到输出,性能趋势图表等。
更多信息:

相关问题