apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.32k stars 2.09k forks source link

ArithmeticException: / by zero when sampleCount is equal to 0 #3445

Closed asfimport closed 10 years ago

asfimport commented 10 years ago

Charlie Stott (Bug 57052): When I use Mail Reader Sampler to read a gmail account using imaps, and there are no messages to retrieve, the thread ends with an exception:

Caused by: java.lang.ArithmeticException: / by zero

As long as there is a message, this will not occur.

My test suite needs to wait for an email to arrive, then act on the contents.

When the Mail Reader Sampler is used within a loop/conditional element, the thread ends and the loop is broken.

This seems a trivial fix (check no of messages before using value as a divisor). If someone can point me in the right direction (source repo?) I am happy to submit code, pull request, etc..

Severity: normal OS: All

Duplicates:

asfimport commented 10 years ago

@pmouawad (migrated from Bugzilla): Hello, Can you show full stacktrace ? It is possible issue has been fixed in nightly build.

http://jmeter.apache.org/nightly.html

Installing JMeter runtime

Download the _bin and _lib files Unpack the archives into the same directory structure The other archives are not needed to run JMeter.

asfimport commented 10 years ago

Charlie Stott (migrated from Bugzilla): I have appended the jmeter.log output below including the stacktrace.

Please can you point to the change that would have fixed this issue in the nightly build? I could not find any other reference to the problem.

jmeter.log contains the following stacktrace: 2014/10/03 16:41:57 INFO - jmeter.engine.StandardJMeterEngine: Running the test! 2014/10/03 16:41:57 INFO - jmeter.samplers.SampleEvent: List of sample_variables: [] 2014/10/03 16:41:57 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(true,local) 2014/10/03 16:41:57 INFO - jmeter.engine.StandardJMeterEngine: Starting setUp thread groups 2014/10/03 16:41:57 INFO - jmeter.engine.StandardJMeterEngine: Starting setUp ThreadGroup: 1 : setUp Thread Group 2014/10/03 16:41:57 INFO - jmeter.engine.StandardJMeterEngine: Starting 1 threads for group setUp Thread Group. 2014/10/03 16:41:57 INFO - jmeter.engine.StandardJMeterEngine: Thread will continue on error 2014/10/03 16:41:57 INFO - jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 1 perThread 1000.0 delayedStart=false 2014/10/03 16:41:57 INFO - jmeter.threads.ThreadGroup: Started thread group number 1 2014/10/03 16:41:57 INFO - jmeter.engine.StandardJMeterEngine: Waiting for all setup thread groups to exit 2014/10/03 16:41:57 INFO - jmeter.threads.JMeterThread: Thread started: setUp Thread Group 1-1 2014/10/03 16:42:02 ERROR - jmeter.threads.JMeterThread: Test failed! java.lang.Error: java.lang.reflect.InvocationTargetException at org.apache.jmeter.util.JMeterUtils.runSafe(JMeterUtils.java:1300) at org.apache.jmeter.visualizers.TableVisualizer.add(TableVisualizer.java:163) at org.apache.jmeter.reporters.ResultCollector.sendToVisualizer(ResultCollector.java:553) at org.apache.jmeter.reporters.ResultCollector.sampleOccurred(ResultCollector.java:529) at org.apache.jmeter.threads.ListenerNotifier.notifyListeners(ListenerNotifier.java:84) at org.apache.jmeter.threads.JMeterThread.notifyListeners(JMeterThread.java:783) at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:443) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.reflect.InvocationTargetException at java.awt.EventQueue.invokeAndWait(Unknown Source) at javax.swing.SwingUtilities.invokeAndWait(Unknown Source) at org.apache.jmeter.util.JMeterUtils.runSafe(JMeterUtils.java:1296) ... 8 more Caused by: java.lang.ArithmeticException: / by zero at org.apache.jmeter.visualizers.TableSample.<init>(TableSample.java:65) at org.apache.jmeter.visualizers.TableVisualizer$1.run(TableVisualizer.java:178) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)

2014/10/03 16:42:02 INFO - jmeter.threads.JMeterThread: Thread finished: setUp Thread Group 1-1 2014/10/03 16:42:02 INFO - jmeter.engine.StandardJMeterEngine: All Setup Threads have ended 2014/10/03 16:42:02 INFO - jmeter.engine.StandardJMeterEngine: No enabled thread groups found 2014/10/03 16:42:02 INFO - jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test 2014/10/03 16:42:02 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(false,local)

asfimport commented 10 years ago

Charlie Stott (migrated from Bugzilla): I tried to download and test in the nightly build, but the current build (r1628809) does not even load in windows. I created a hybrid from the jar and libraries, but could not load my test plan without error.

asfimport commented 10 years ago

Charlie Stott (migrated from Bugzilla): On further investigation, the latest nightly build appears to have the problem fixed.

My previous attempt to try nightly failed due to getting different versions of the lib and bin downloads, due to the build updating the distributions at almost the exact same time!!

asfimport commented 10 years ago

@pmouawad (migrated from Bugzilla): Date: Wed Oct 1 18:57:25 2014 New Revision: 1628809

URL: http://svn.apache.org/r1628809 Log: https://github.com/apache/jmeter/issues/3432 - Unable to Publish JMS Msg for Tibco EMS using Jmeter Publisher/Subscriber. Fix java.lang.ArithmeticException: / by zero https://github.com/apache/jmeter/issues/3432

Modified: jmeter/trunk/src/core/org/apache/jmeter/visualizers/TableSample.java

Date: Sat Oct 4 19:01:18 2014 New Revision: 1629438

URL: http://svn.apache.org/r1629438 Log: https://github.com/apache/jmeter/issues/3445 - ArithmeticException: / by zero when sampleCount is equal to 0 https://github.com/apache/jmeter/issues/3445

Modified: jmeter/trunk/xdocs/changes.xml

asfimport commented 10 years ago

@pmouawad (migrated from Bugzilla): Date: Sun Oct 5 19:53:45 2014 New Revision: 1629524

URL: http://svn.apache.org/r1629524 Log: https://github.com/apache/jmeter/issues/3445 - ArithmeticException: / by zero when sampleCount is equal to 0 https://github.com/apache/jmeter/issues/3445

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/TableVisualizer.java