Skip to content

当我的运行规则文本如下时会出现 OOM 的情况 #426

@haycco

Description

@haycco

QLExpress 4.0.9 版本

在调用脚本校验和运行方法时,语法解析器似乎出现了死循环疯狂创建解析对象无法释放
调用的方法是:

1、com.alibaba.qlexpress4.Express4Runner#check(java.lang.String)
2、com.alibaba.qlexpress4.Express4Runner#execute(java.lang.String, java.util.Map<java.lang.String,java.lang.Object>, com.alibaba.qlexpress4.QLOptions)

参数如下:
QLOptions.builder().cache(true).timeoutMillis(5000L).build()
待执行的脚本如下:

"Y_D_ / (if (( item in [ 'S45C','SUS304' ] && Y_D_ < 65 )) { 1500; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ < 80 && Y_D_ >= 65 )) { 1200; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ < 80 && Y_D_ >= 65 )) { 1200; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ < 100 && Y_D_ >= 80 )) { 1000; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ < 120 && Y_D_ >= 100 )) { 800; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ < 150 && Y_D_ >= 120 )) { 600; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ < 180 && Y_D_ >= 150 )) { 400; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ < 200 && Y_D_ >= 180 )) { 300; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ <= 230 && Y_D_ >= 200 )) { 200; } else if (( item in [ '金','POM' ] && Y_D_ < 65 )) { 2000; } else if (( item in [ '金','POM' ] && Y_D_ < 80 && Y_D_ >= 65 )) { 1500; } else if (( item in [ '金','POM' ] && Y_D_ < 100 && Y_D_ >= 80 )) { 1200; } else if (( item in [ '金','POM' ] && Y_D_ < 150 && Y_D_ >= 100 )) { 1000; } else if (( item in [ '金','POM' ] && Y_D_ < 200 && Y_D_ >= 150 )) { 800; } else if (( item in [ '金','POM' ] && Y_D_ <= 230 && Y_D_ >= 200 )) { 600; } else { null } )"

如果我把外层的运算符 "Y_D_ / ()" 拿掉,内部的文本校验和运行都能正常通过。只要外层增加了运算就会出现 OOM,除非把内部的 if-else 都改成三元表达式,帮忙看看这个 BUG 要如何修复?

下面这段文本是能正常校验和执行的
"if (( item in [ 'S45C','SUS304' ] && Y_D_ < 65 )) { 1500; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ < 80 && Y_D_ >= 65 )) { 1200; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ < 80 && Y_D_ >= 65 )) { 1200; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ < 100 && Y_D_ >= 80 )) { 1000; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ < 120 && Y_D_ >= 100 )) { 800; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ < 150 && Y_D_ >= 120 )) { 600; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ < 180 && Y_D_ >= 150 )) { 400; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ < 200 && Y_D_ >= 180 )) { 300; } else if (( item in [ 'S45C','SUS304' ] && Y_D_ <= 230 && Y_D_ >= 200 )) { 200; } else if (( item in [ '金','POM' ] && Y_D_ < 65 )) { 2000; } else if (( item in [ '金','POM' ] && Y_D_ < 80 && Y_D_ >= 65 )) { 1500; } else if (( item in [ '金','POM' ] && Y_D_ < 100 && Y_D_ >= 80 )) { 1200; } else if (( item in [ '金','POM' ] && Y_D_ < 150 && Y_D_ >= 100 )) { 1000; } else if (( item in [ '金','POM' ] && Y_D_ < 200 && Y_D_ >= 150 )) { 800; } else if (( item in [ '金','POM' ] && Y_D_ <= 230 && Y_D_ >= 200 )) { 600; } else { null } "

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions