Bug 38234

Summary: Using Graph Results ends up ArithmeticException
Product: JMeter - Now in Github Reporter: Hiroto Watanabe <nabehiro>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED WORKSFORME    
Severity: critical CC: msechres, nabehiro
Priority: P2    
Version: 2.1.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: jmx file for the above test plan

Description Hiroto Watanabe 2006-01-12 07:28:24 UTC
Using Graph Results ends up ArithmeticException.

I invoked JMeter and added a Thread Group.
Then I attached "Http Request Defaults", "HTTP Request" and
"Graph Results". I executed the test once. It worked successfully
(It's natural, for it's introduced in the tutorial.).

However, when (A) I remove the Graph Results component and attach
a Graph Results component again and execute the test, it fails
saying "Exception in thread "AWT-EventQueue-0" java.lang.ArithmeticException: / 
by zero
     at org.apache.jmeter.visualizers.Graph.drawSample(Graph.java:209)
     at org.apache.jmeter.visualizers.Graph.paintComponent(Graph.java:199)
   etc, etc..

Note that it occurs when I iterate (A) procedure three or four (it varies.
I don't know why) times.

Exception above took place when I tried to access a Tomcat example webapp.
So, all parameters set for components are : 
     "localhost" to [Http Request Defaults] -> [Server Name or IP]
     "8080" to [Http Request Defaults] -> [Port Number]
     "/servlets-example/servlet/HelloWorldExample" to [HTTP Request] -> [Path:]

  Once a crush set off, JMeter dumps ArithmeticException every time you click
on Graph Results component. It's possible, but irretating to remove the
malfunctioned component as it dumps a lot of messages and gets heavy making
manipulation annoying.
  Moreover, you can't escape from the curse of the component. Even if you
remove the malfunctioned Graph Results component, you will see the same
phenomenon when you attach a new Graph Results component to Thread Group.
  
  For the reason of cursing, I think this bug has to be redeemed.


#The bug resides in the latest nightly build (20060112) too.
Comment 1 Sebb 2006-01-12 11:56:05 UTC
What happens if you delete the Graph Results and save the testplan, exit and 
restart JMeter? Can you add the Graph Results OK this time?

If this works, it would at least be a work-round until the problem is fixed.
Comment 2 Hiroto Watanabe 2006-01-13 02:20:35 UTC
(In reply to comment #1)
> What happens if you delete the Graph Results and save the testplan, exit and 
> restart JMeter? Can you add the Graph Results OK this time?
It goes OK, for a short term.

Just adding a Graph Results component affects nothing immediately.
But running JMeter after that adding occasionally, yet again, 
ends up continual dumping of ArithmeticException.

"occasionally" means it runs successfully for several times until the potencial 
disease comes into effect. Once it happens, JMeter no longer gets healed up
during its lifecycle.

> If this works, it would at least be a work-round until the problem is fixed.
Technically, you are right.
I'll be waiting until it's fixed.


///////////////////// new case //////////////////////////////
The bug appears in simpler situation.

What I tried follows below:
01. Invoke jmeter.bat
02. Add Thread Group to Test Plan
03. Set "100" to [Thread Group]->[Loop Count:]
04. Add HTTP Request to Thread Group
05. Set "localhost" to [HTTP Request]->[Server Name or IP]
06. Set "8080" to [HTTP Request]->[Port Number]
07. Set "/servlets-examples/servlet/HelloWorldExample" to [HTTP Request]->[Path]
08. Add Graph Results to Thread Group
09. Type in Ctrl-R (that is, [Run]->[Start]) MANY times (*1)

After you type in Ctrl-R N times, the program fails (starts being cursed).
N varies. I don't know why. N I encountered includes (and may not be limited
to) 1(first time), 16, 18, 24, 28 and 42.
 

  Here, if you leave step 03 so that [Thread Group]->[Loop Count] remains "1",
N is much bigger (Might be infinite. I stopped trying after typing Ctrl-R 100 
times). 
  I introduce my computer's performance in case the problem is performance
-related(*2). My computer has 1.6GHz CPU and 1.0GByte memory. 
It used up roughly 750MByte of them when I typed Ctrl-R.

(*1) JMeter asks me to save test plan before running. I set "hoge.jmx".
(*2) May not be appropriate (proper?) usage. Sorry for poor English.
Comment 3 Sebb 2006-04-29 14:50:38 UTC
Updated 2.1 branch - put in fix to prevent graphMax becoming < 1
Comment 4 Mark Sechrest 2006-05-11 12:54:08 UTC
*** Bug 39558 has been marked as a duplicate of this bug. ***
Comment 5 Hemant 2006-11-21 05:33:33 UTC
>jmeter -v
Copyright (c) 1998-2005 The Apache Software Foundation
Version 2.1.20050419


I tried setup for the openJMS testing and the same issue comes up for the
publisher sapler and graph results.
Exception in thread "AWT-EventQueue-0" java.lang.ArithmeticException: / by zero
        at org.apache.jmeter.visualizers.Graph.drawSample(Graph.java:229)
        at org.apache.jmeter.visualizers.Graph.paintComponent(Graph.java:217)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JViewport.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JViewport.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JSplitPane.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JLayeredPane.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JComponent.paintToOffscreen(Unknown Source)
        at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
        at javax.swing.RepaintManager.paint(Unknown Source)
        at javax.swing.JComponent._paintImmediately(Unknown Source)
        at javax.swing.JComponent.paintImmediately(Unknown Source)
        at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
        at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
        at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
I have tried all jre versions and win 2000 and 2003. Also the workaround
suggested (saving file before use) does not work.

Steps to reproduce:
Building a Test Plan

For a Producer Sampler
1. Add a Thread Group.
2. Add the producer sampler "Producer Sampler" from the Sampler menu.
3. Highlight the Producer Sampler then right click to add the producer listener
"View Producer Results" from the Listener menu.
4. Go to the Thread Group element and set the Number of Threads, Ramp-Up Period
and Loop Count to 1.

For a Consumer Sampler
1. Add a Thread Group.
2. Add the consumer sampler "Consumer Sampler" from the Sampler menu.
3. Highlight the Consumer Sampler then right click to add the consumer listener
"View Consumer Results" from the Listener menu.
4. Go to the Thread Group element and set the Number of Threads, Ramp-Up Period
and Loop Count to 1.
Comment 6 Hemant 2006-11-21 05:39:48 UTC
Created attachment 19153 [details]
jmx file for the above test plan
Comment 7 Sebb 2006-11-27 15:06:02 UTC
Cannot use the JMX file, as it uses classes that are not part of JMeter:
org.activemq.sampler.Producer

Also, the quoted stack trace does not agree with the current source.

Please try again with the current nightly, and post attach the stack trace if it
occurs again.
Comment 8 The ASF infrastructure team 2022-09-24 20:37:36 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1661