jmeter
jmeter copied to clipboard
5.6.2: JDBC Sampler initialization failure makes test fail without any visible error
Expected behavior
I am trying to test different DB with JMeter 5.6.2 and I expect for the test to run without issues.
As example JDBC Connection Configuration for MSSQL is in the attached picture.
Actual behavior
When I run the test, nothing happens. No logs are written, nothing seems to be executed, no users are running. But when I try to close jmeter I get an message saying that I cannot do that since there is a test running.
I enabled debug logs for jdbc execution but no extra logs are present.
When doing the same test in Jmeter 5.4.3 (see attached JDBC Connection Configuration for MSSQL) it works.
This does not happen for all types of DB. It works for mongodb, mysql, mariadb, but id does not work for postgresql and mssql.
I am using the same jar files for jdbc drivers put in lib folder of both versions of jmeter.
Steps to reproduce the problem
- Setup a test for MSSQL or Postgresql in Jmeter 5.6.2
- Run the test -> nothing happens, no logs are generated but also no results.
- Try to close jmeter -> error message popup saying that a test is running.
- Repeat with MSSQL 5.4.3 -> test is running successfully.
JMeter Version
5.6.2
Java Version
java version 11.0.16.1
OS Version
Microsoft Windows [version 10.0.19044.3693]
Please attach the test plan that reproduces the issue
Please find attached the problematic jmx. MSSQL_BugTest.zip
The root cause is ${__time(yyyy-MM-dd hh:mm:sss)}
You should have ss
instead of sss
.
In any case, you'd better use query parameters rather than building the string with jmeter templates.
It is sad JMeter does not report errors from StandardJMeterEngine.notifyTestListenersOfStart
java.lang.IllegalArgumentException: Unable to parse date format yyyy-MM-dd hh:mm:sss
at org.apache.jmeter.functions.TimeFunction.lambda$static$2(TimeFunction.java:80)
at com.github.benmanes.caffeine.cache.LocalLoadingCache.lambda$newMappingFunction$2(LocalLoadingCache.java:145)
at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2406)
at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1916)
at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2404)
at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2387)
at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:108)
at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:56)
at org.apache.jmeter.functions.TimeFunction.execute(TimeFunction.java:137)
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:139)
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:114)
at org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:104)
at org.apache.jmeter.testbeans.TestBeanHelper.unwrapProperty(TestBeanHelper.java:189)
at org.apache.jmeter.testbeans.TestBeanHelper.prepare(TestBeanHelper.java:139)
at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:243)
at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:424)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.IllegalArgumentException: Too many pattern letters: s
at java.base/java.time.format.DateTimeFormatterBuilder.parseField(DateTimeFormatterBuilder.java:2020)
at java.base/java.time.format.DateTimeFormatterBuilder.parsePattern(DateTimeFormatterBuilder.java:1804)
at java.base/java.time.format.DateTimeFormatterBuilder.appendPattern(DateTimeFormatterBuilder.java:1772)
at java.base/java.time.format.DateTimeFormatter.ofPattern(DateTimeFormatter.java:566)
at org.apache.jmeter.functions.TimeFunction.lambda$static$2(TimeFunction.java:77)
... 20 more
Indeed that was the issue, but I still wonder why it works on 5.4.3.
Thanks for help!