Bug 57052 - ArithmeticException: / by zero when sampleCount is equal to 0
Summary: ArithmeticException: / by zero when sampleCount is equal to 0
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.11
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
: 56972 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-10-03 05:17 UTC by Charlie Stott
Modified: 2014-11-16 12:59 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Charlie Stott 2014-10-03 05:17:08 UTC
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..
Comment 1 Philippe Mouawad 2014-10-03 05:47:06 UTC
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.
Comment 2 Charlie Stott 2014-10-03 06:56:58 UTC
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*)
Comment 3 Charlie Stott 2014-10-03 07:10:00 UTC
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.
Comment 4 Charlie Stott 2014-10-03 07:19:25 UTC
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!!
Comment 5 Philippe Mouawad 2014-10-04 19:01:58 UTC
Date: Wed Oct  1 18:57:25 2014
New Revision: 1628809

URL: http://svn.apache.org/r1628809
Log:
Bug 56972 - Unable to Publish JMS Msg for Tibco EMS using Jmeter Publisher/Subscriber.
Fix java.lang.ArithmeticException: / by zero
Bugzilla Id: 56972

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:
Bug 57052 - ArithmeticException: / by zero when sampleCount is equal to 0
Bugzilla Id: 57052

Modified:
    jmeter/trunk/xdocs/changes.xml
Comment 6 Philippe Mouawad 2014-10-05 19:55:52 UTC
Date: Sun Oct  5 19:53:45 2014
New Revision: 1629524

URL: http://svn.apache.org/r1629524
Log:
Bug 57052 - ArithmeticException: / by zero when sampleCount is equal to 0
Bugzilla Id: 57052

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/TableVisualizer.java
Comment 7 Philippe Mouawad 2014-11-16 12:59:59 UTC
*** Bug 56972 has been marked as a duplicate of this bug. ***