You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2012/05/23 00:32:09 UTC

[Bug 53277] New: HashTree can theoretically drop elements

https://issues.apache.org/bugzilla/show_bug.cgi?id=53277

          Priority: P2
            Bug ID: 53277
          Assignee: issues@jmeter.apache.org
           Summary: HashTree can theoretically drop elements
          Severity: normal
    Classification: Unclassified
                OS: Windows XP
          Reporter: sebb@apache.org
          Hardware: PC
            Status: NEW
           Version: 2.6
         Component: Main
           Product: JMeter

The HashTree class currently uses a HashMap to store test elements.

Now a HashMap cannot store two Objects which compare equal and have the same
hash code. Test elements currently use the system hash code, so collisions are
unlikely; however they are not impossible. It's quite easy to create multiple
test elements which compare equal.

So there is a risk that a new element which is added to the HashTree could
displace an existing entry.

One solution to this is to use IdentityHashMap instead of HashMap; this uses ==
rather than equals when comparing elements.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53277] HashTree can theoretically drop elements

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53277

--- Comment #2 from Geert-Jan <ge...@ericsson.com> ---
Hi,

I think I just ran into this bug, proving it is not only theoretical. Th
exception I got looks like:

2012/06/19 14:56:30 ERROR - jmeter.JMeter: Error in NonGUIDriver
java.lang.NullPointerException
        at
org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:975)
        at
org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:975)
        at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:959)
        at
org.apache.jmeter.engine.StandardJMeterEngine.configure(StandardJMeterEngine.java:176)
        at org.apache.jmeter.JMeter.runNonGui(JMeter.java:778)
        at org.apache.jmeter.JMeter.startNonGui(JMeter.java:716)
        at org.apache.jmeter.JMeter.start(JMeter.java:377)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.jmeter.NewDriver.main(NewDriver.java:216)

This was caused by two identical Include-Controllers on the main (and same)
level of a thread group. After I moved the second Include-Controller one level
up, as a child of a Simple Controller, the problem was solved. Not sure but it
can be related to the usage of HashMap. Just one funny remark, I only got this
NullPointerException when running jmeter with the -n option.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53277] HashTree can theoretically drop elements

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53277

--- Comment #1 from Sebb <se...@apache.org> ---
Unfortunately, this causes unit test failures in

PackageTest.testEqualsAndHashCode1()
PackageTest.testEqualsAndHashCode2()

It looks like supporting HashTree equality will need additional work.
So for now at least we probably have to accept the theoretical risk of a hash
code and equals collision.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53277] HashTree can theoretically drop elements

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53277

--- Comment #3 from Sebb <se...@apache.org> ---
Which version of JMeter were you using?

I think you have hit Bug 50898 which is fixed in 2.7.

[It's unlikely that this bug will cause an NPE]

The behaviour in non-GUI mode is likely different because in GUI mode there are
 additional variables that affect the hash code.

-- 
You are receiving this mail because:
You are the assignee for the bug.