jmeter icon indicating copy to clipboard operation
jmeter copied to clipboard

5.6.2: JDBC Sampler initialization failure makes test fail without any visible error

Open johnqa opened this issue 1 year ago • 4 comments

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. JDBC Connection Configuration 5 6 2

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. JDBC Connection Configuration 5 4 3

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

  1. Setup a test for MSSQL or Postgresql in Jmeter 5.6.2
  2. Run the test -> nothing happens, no logs are generated but also no results.
  3. Try to close jmeter -> error message popup saying that a test is running.
  4. 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]

johnqa avatar Dec 13 '23 10:12 johnqa

Please attach the test plan that reproduces the issue

vlsi avatar Dec 18 '23 10:12 vlsi

Please find attached the problematic jmx. MSSQL_BugTest.zip

johnqa avatar Dec 18 '23 15:12 johnqa

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

vlsi avatar Dec 18 '23 17:12 vlsi

Indeed that was the issue, but I still wonder why it works on 5.4.3.

Thanks for help!

johnqa avatar Dec 19 '23 13:12 johnqa