You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

JMeter中如何在Parallel Controller内部嵌套使用Parallel Controller

JMeter嵌套Parallel Controller运行报错解决方案

你遇到的Attempting to reset the thread context错误是0.11及更早版本BlazeMeter Parallel Controller的已知限制,该版本不支持嵌套使用Parallel Controller,你当前的脚本结构是在Parallel Controller1内部嵌套了Parallel Controller2、3,因此触发线程上下文冲突异常。
你当前的脚本结构如下:
结构示意图
对应的报错日志为:

2021-08-24 17:51:48,819 ERROR o.a.j.t.JMeterThread: Error while processing sampler: 'bzm - Parallel Controller2'.
java.lang.RuntimeException: Attempting to reset the thread context
    at org.apache.jmeter.testelement.AbstractTestElement.setThreadContext(AbstractTestElement.java:579) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:623) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) [ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core.jar:5.4.1]
    at com.blazemeter.jmeter.controller.JMeterThreadParallel.run(JMeterThreadParallel.java:61) [jmeter-parallel-0.11.jar:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_211]
    at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_211]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_211]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_211]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_211]

修复步骤

  • 优先升级插件:打开JMeter插件管理器,找到Parallel Controller & Sampler,升级到0.12及以上的最新稳定版本,升级完成后不需要调整原有嵌套结构即可正常运行,内层Parallel Controller的请求也可以正常并行执行。
  • 无法升级时调整脚本结构:如果受环境限制不能升级插件,需要拆解嵌套层级,把Parallel Controller2、3内部的所有请求直接移到Parallel Controller1的子节点下,同一Parallel Controller下的所有子节点默认并行执行,如果需要做事务统计,可以给对应请求套独立的Transaction Controller,放在Parallel Controller1下即可。
  • 验证配置:调整后确认每个Parallel Controller的Maximum number of parallel threads参数值不小于当前控制器下需要并行的请求/子控制器数量,避免资源不足导致并行失效;不要在Parallel Controller内部放非线程安全的共享元件,如有必要使用JSR223、用户定义变量等元件,要确保每个线程的配置独立。

内容的提问来源于stack exchange,提问作者Ara Galstyan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.07 03:30:04