Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]场景中的循环控制器判断含特殊字符的变量报错 #30697

Closed
ywang9-12 opened this issue May 8, 2024 · 1 comment
Closed
Assignees
Labels
v3.x 类型:缺陷 使用过程中出现不符合预期情况

Comments

@ywang9-12
Copy link

联系方式

ywang9_12@qq.com

MeterSphere 版本

v2.10.11-lts-a580bd0a

使用外置数据库

问题描述

1、提取接口返回结果存储变量为output,output结果为"output": "> 10.80.81.0/24 0.0.0.0 0 32768 i\n",提取结果正常
2、循环控制器判断output是否包含私网10.80.81.0
控制台报错:
2024-05-08 16:08:51 INFO faaba0ae 1-1 Thread started: faaba0ae 1-1
2024-05-08 16:08:52 ERROR faaba0ae 1-1 An error occurred while evaluating the expression ""
> 10.80.81.0/24 0.0.0.0 0 32768 i
"!~"(\n|.)10.80.20.0(\n|.)""

org.apache.jmeter.functions.Jexl3Function.execute:96@1:64 tokenization error near '... 0 32768 i ...'
org.apache.commons.jexl3.JexlException$Tokenization
at org.apache.commons.jexl3.JexlEngine.createScript(JexlEngine.java:375)
at org.apache.jmeter.functions.Jexl3Function.execute(Jexl3Function.java:96)
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:137)
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:110)
at org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:100)
at org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:280)
at org.apache.jmeter.control.IfController.getCondition(IfController.java:170)
at org.apache.jmeter.control.IfController.next(IfController.java:231)
at org.apache.jmeter.control.TransactionController.nextIsAController(TransactionController.java:176)
at org.apache.jmeter.control.GenericController.next(GenericController.java:175)
at org.apache.jmeter.control.TransactionController.nextWithTransactionSampler(TransactionController.java:161)
at org.apache.jmeter.control.TransactionController.next(TransactionController.java:133)
at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:222)
at org.apache.jmeter.control.GenericController.next(GenericController.java:175)
at org.apache.jmeter.control.CriticalSectionController.next(CriticalSectionController.java:146)
at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:222)
at org.apache.jmeter.control.GenericController.next(GenericController.java:175)
at org.apache.jmeter.control.LoopController.next(LoopController.java:134)
at org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.java:99)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:299)
at java.base/java.lang.Thread.run(Thread.java:840)
2024-05-08 16:08:52 INFO faaba0ae 1-1 Thread is done: faaba0ae 1-1
2024-05-08 16:08:52 INFO faaba0ae 1-1 Thread finished: faaba0ae 1-1

重现步骤

1、var.put变量"output": "*> 10.80.81.0/24 0.0.0.0 0 32768 i\n"
2、循环控制器判断output是否包含私网10.80.81.0

期待的正确结果

循环控制器可处理含特殊字符的变量

相关日志输出

2024-05-08 16:08:52,033 [faaba0ae 1-1] INFO  JMETER ? - JMETER-LOG 2024-05-08 16:08:52 ERROR faaba0ae 1-1 An error occurred while evaluating the expression ""*> 10.80.81.0/24    0.0.0.0                  0         32768 i
"!~"(\n|.)*10.80.20.0(\n|.)*""

org.apache.jmeter.functions.Jexl3Function.execute:96@1:64 tokenization error near '...    0         32768 i ...'
org.apache.commons.jexl3.JexlException$Tokenization
   at org.apache.commons.jexl3.JexlEngine.createScript(JexlEngine.java:375)
   at org.apache.jmeter.functions.Jexl3Function.execute(Jexl3Function.java:96)
   at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:137)
   at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:110)
   at org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:100)
   at org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:280)
   at org.apache.jmeter.control.IfController.getCondition(IfController.java:170)
   at org.apache.jmeter.control.IfController.next(IfController.java:231)
   at org.apache.jmeter.control.TransactionController.nextIsAController(TransactionController.java:176)
   at org.apache.jmeter.control.GenericController.next(GenericController.java:175)
   at org.apache.jmeter.control.TransactionController.nextWithTransactionSampler(TransactionController.java:161)
   at org.apache.jmeter.control.TransactionController.next(TransactionController.java:133)
   at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:222)
   at org.apache.jmeter.control.GenericController.next(GenericController.java:175)
   at org.apache.jmeter.control.CriticalSectionController.next(CriticalSectionController.java:146)
   at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:222)
   at org.apache.jmeter.control.GenericController.next(GenericController.java:175)
   at org.apache.jmeter.control.LoopController.next(LoopController.java:134)
   at org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.java:99)
   at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:299)
   at java.base/java.lang.Thread.run(Thread.java:840)

附加信息

No response

@github-actions github-actions bot added the 状态:待处理 已分配给相关处理人等待处理人处理并更新状态 label May 8, 2024
@youliyuan-fit2cloud youliyuan-fit2cloud added 类型:缺陷 使用过程中出现不符合预期情况 and removed 状态:待处理 已分配给相关处理人等待处理人处理并更新状态 labels May 8, 2024
@youliyuan-fit2cloud youliyuan-fit2cloud added this to the v2.10.16-lts milestone May 8, 2024
@youliyuan-fit2cloud
Copy link

你好,经内部沟通,研发同学反馈,这个如果要支持得修改 __jexl3 表达式,影响范围太大了,无法确保已存在原表达式的用户都能兼容,当前版本暂不处理,即将发布的V3 版本支持自定义表达式可以解决此问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3.x 类型:缺陷 使用过程中出现不符合预期情况
Projects
None yet
Development

No branches or pull requests

2 participants