The java.text.SimpleDateFormatter class is not thread safe, but jmeter reuses a SimpleDateFormatter instance across threads. As a result, the saved timestamp is sometimes incorrect. Here is the stack trace of one of the offending locations: org.apache.jmeter.save.CSVSaveService.resultToDelimitedString(CSVSaveService.java:868) org.apache.jmeter.save.CSVSaveService.resultToDelimitedString(CSVSaveService.java:784) org.apache.jmeter.reporters.ResultCollector.sampleOccurred(ResultCollector.java:559) org.apache.jmeter.threads.ListenerNotifier.notifyListeners(ListenerNotifier.java:67) org.apache.jmeter.threads.JMeterThread.notifyListeners(JMeterThread.java:819) org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:493) org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:410) org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:241) java.lang.Thread.run(Thread.java:745)
(In reply to eric.markowitz from comment #0) > The java.text.SimpleDateFormatter class is not thread safe, but jmeter > reuses a SimpleDateFormatter instance across threads. As a result, the > saved timestamp is sometimes incorrect. Here is the stack trace of one of > the offending locations: > > org.apache.jmeter.save.CSVSaveService.resultToDelimitedString(CSVSaveService. > java:868) > org.apache.jmeter.save.CSVSaveService.resultToDelimitedString(CSVSaveService. > java:784) > org.apache.jmeter.reporters.ResultCollector.sampleOccurred(ResultCollector. > java:559) > org.apache.jmeter.threads.ListenerNotifier.notifyListeners(ListenerNotifier. > java:67) > org.apache.jmeter.threads.JMeterThread.notifyListeners(JMeterThread.java:819) > org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread. > java:493) > org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:410) > org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:241) > java.lang.Thread.run(Thread.java:745) Hello Eric, Thanks for report, but where is the SimpleDateFormatter you mention ? What version of JMeter are you using ? Thanks
I omitted some stack frames previously. Here is the full stack: at java.text.SimpleDateFormat.format(SimpleDateFormat.java:971) at java.text.SimpleDateFormat.format(SimpleDateFormat.java:935) at java.text.DateFormat.format(DateFormat.java:345) at org.apache.jmeter.save.CSVSaveService.resultToDelimitedString(CSVSaveService.java:868) at org.apache.jmeter.save.CSVSaveService.resultToDelimitedString(CSVSaveService.java:784) at org.apache.jmeter.reporters.ResultCollector.sampleOccurred(ResultCollector.java:559) at org.apache.jmeter.threads.ListenerNotifier.notifyListeners(ListenerNotifier.java:67) at org.apache.jmeter.threads.JMeterThread.notifyListeners(JMeterThread.java:819) at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:493) at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:410) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:241) at java.lang.Thread.run(Thread.java:745) I noticed the problem in jmeter version3.
Hi Team, Could we use DateTimeFormatter to fix this issue ? Instanciating a SimpleDateFormat for each call might be overkill. Using ThreadLocal SimpleDateFormat is not simple here
Created attachment 34806 [details] Patch that does not handle setLenient
*** Bug 60818 has been marked as a duplicate of this bug. ***
I don't think Bug 60818 is a duplicate. Bug 60818 refers to a corruption of the CSV file, while this bug referes to incorrect timestamps written to the CSV file.
(In reply to eric.markowitz from comment #6) > I don't think Bug 60818 is a duplicate. Bug 60818 refers to a corruption of > the CSV file, while this bug referes to incorrect timestamps written to the > CSV file. Hi, The other bug is Invalid in fact. See related discussion. But if there is a corruption, it's in the issue your raised. Regards
Hi, Any feedback on patch ? Or alternative solution ? I think we need to fix this bug before 3.2 . Thanks
Author: pmouawad Date: Sat Mar 18 10:12:31 2017 New Revision: 1787542 URL: http://svn.apache.org/viewvc?rev=1787542&view=rev Log: Bug 60830 - Timestamps in CSV file could be corrupted due to sharing a SimpleDateFormatter across threads Bugzilla Id: 60830 Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleSaveConfiguration.java jmeter/trunk/src/core/org/apache/jmeter/save/CSVSaveService.java jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleSaveConfiguration.java jmeter/trunk/xdocs/changes.xml
Author: pmouawad Date: Sun Mar 26 20:00:59 2017 New Revision: 1788774 URL: http://svn.apache.org/viewvc?rev=1788774&view=rev Log: Bug 60830 Timestamps in CSV file could be corrupted due to sharing a SimpleDateFormatter across threads Bugzilla Id: 60830 Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleSaveConfiguration.java
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4322