You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by Jun Zhong <ju...@sbcglobal.net> on 2004/04/05 01:29:22 UTC

Should the HashSet used in org/apache/jmeter/threads/TestCompiler.java be synchronized ?

Should the variable "pairing" in org/apache/jmeter/threads/TestCompiler.java be synchronized ?
 
I am evaluating JMeter as a stress tool to test Tomcat. I configurated 200 threads,
each thread repeated 30 times. The test plan was run in an endless while loop.
After a while (usually within half an hour), the test hangs.
 
Furthur investigation revealed that the state of the variable "pairing" was corrupted by
concurrent access and modification by multiple threads.
 
I modified the line 
private static pairing = new HashSet();
to 
private static pairing = Collections.synchronizedSet(new HashSet());
 
The problem disappeared with the change. The test lasted for more than 24 hours before
I interruped it.
 
Thanks,
June Zhong


Re: Should the HashSet used in org/apache/jmeter/threads/TestCompiler.java be synchronized ?

Posted by se...@apache.org.
That explains it - the fix was made in October, and JMeter 1.9.1 was released in August/September - i.e. before the fix.

So we were referring to different source files.

Release 2.0 should fix the problem - if not, please let us know.

S
----- Original Message ----- 
From: "Jun Zhong" <ju...@sbcglobal.net>
To: "JMeter Developers List" <jm...@jakarta.apache.org>
Sent: Tuesday, April 06, 2004 10:55 PM
Subject: Re: Should the HashSet used in org/apache/jmeter/threads/TestCompiler.java be synchronized ?


I am using JMeter 1.9.1.
"pairing" is a static varible which can be accessed concurrently by multiple threads.
On my system, ( 8 way Solaris Sparc E4500), intermittenly some Entry in HashSet
loops back into itself so the program is stuck in the while loop in java.util.HashMap.containsKey.
( the code of the while loop is 
...
Entry e = table [i];
while ( e ! = null ) {
   if ( e.hash == hash && eq(k, e.key) )
    return true;
   e = e.next;
}
return false;
)
 
SynchronizedSet synchronizes access to the static "pairing" HashSet so the state of it won't be corrupted.
 
Thanks,
June

sebb@apache.org wrote:
I found a similar problem testing on a system with multiple CPUs a few months ago, and checked in a fix in version 1.36 of the
source file (2003-10-22)

As far as I can see, all accesses to the pairing HashSet are now synchronized, so I don't understand how changing to a
synchronizedSet would help - but perhaps I'm missing something.

Which version of JMeter (and TestCompiler.java) are you using?

S.
----- Original Message ----- 
From: "Jun Zhong" 
To: 
Sent: Monday, April 05, 2004 12:29 AM
Subject: Should the HashSet used in org/apache/jmeter/threads/TestCompiler.java be synchronized ?


Should the variable "pairing" in org/apache/jmeter/threads/TestCompiler.java be synchronized ?

I am evaluating JMeter as a stress tool to test Tomcat. I configurated 200 threads,
each thread repeated 30 times. The test plan was run in an endless while loop.
After a while (usually within half an hour), the test hangs.

Furthur investigation revealed that the state of the variable "pairing" was corrupted by
concurrent access and modification by multiple threads.

I modified the line
private static pairing = new HashSet();
to
private static pairing = Collections.synchronizedSet(new HashSet());

The problem disappeared with the change. The test lasted for more than 24 hours before
I interruped it.

Thanks,
June Zhong



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Re: Should the HashSet used in org/apache/jmeter/threads/TestCompiler.java be synchronized ?

Posted by Jun Zhong <ju...@sbcglobal.net>.
I am using JMeter 1.9.1.
"pairing" is a static varible which can be accessed concurrently by multiple threads.
On my system, ( 8 way Solaris Sparc E4500), intermittenly some Entry in HashSet
loops back into itself so the program is stuck in the while loop in java.util.HashMap.containsKey.
( the code of the while loop is 
...
Entry e = table [i];
while ( e ! = null ) {
   if ( e.hash == hash && eq(k, e.key) )
    return true;
   e = e.next;
}
return false;
)
 
SynchronizedSet synchronizes access to the static "pairing" HashSet so the state of it won't be corrupted.
 
Thanks,
June

sebb@apache.org wrote:
I found a similar problem testing on a system with multiple CPUs a few months ago, and checked in a fix in version 1.36 of the
source file (2003-10-22)

As far as I can see, all accesses to the pairing HashSet are now synchronized, so I don't understand how changing to a
synchronizedSet would help - but perhaps I'm missing something.

Which version of JMeter (and TestCompiler.java) are you using?

S.
----- Original Message ----- 
From: "Jun Zhong" 
To: 
Sent: Monday, April 05, 2004 12:29 AM
Subject: Should the HashSet used in org/apache/jmeter/threads/TestCompiler.java be synchronized ?


Should the variable "pairing" in org/apache/jmeter/threads/TestCompiler.java be synchronized ?

I am evaluating JMeter as a stress tool to test Tomcat. I configurated 200 threads,
each thread repeated 30 times. The test plan was run in an endless while loop.
After a while (usually within half an hour), the test hangs.

Furthur investigation revealed that the state of the variable "pairing" was corrupted by
concurrent access and modification by multiple threads.

I modified the line
private static pairing = new HashSet();
to
private static pairing = Collections.synchronizedSet(new HashSet());

The problem disappeared with the change. The test lasted for more than 24 hours before
I interruped it.

Thanks,
June Zhong



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org

Re: Should the HashSet used in org/apache/jmeter/threads/TestCompiler.java be synchronized ?

Posted by se...@apache.org.
I found a similar problem testing on a system with multiple CPUs a few months ago, and checked in a fix in version 1.36 of the
source file (2003-10-22)

As far as I can see, all accesses to the pairing HashSet are now synchronized, so I don't understand how changing to a
synchronizedSet would help - but perhaps I'm missing something.

Which version of JMeter (and TestCompiler.java) are you using?

S.
----- Original Message ----- 
From: "Jun Zhong" <ju...@sbcglobal.net>
To: <jm...@jakarta.apache.org>
Sent: Monday, April 05, 2004 12:29 AM
Subject: Should the HashSet used in org/apache/jmeter/threads/TestCompiler.java be synchronized ?


Should the variable "pairing" in org/apache/jmeter/threads/TestCompiler.java be synchronized ?

I am evaluating JMeter as a stress tool to test Tomcat. I configurated 200 threads,
each thread repeated 30 times. The test plan was run in an endless while loop.
After a while (usually within half an hour), the test hangs.

Furthur investigation revealed that the state of the variable "pairing" was corrupted by
concurrent access and modification by multiple threads.

I modified the line
private static pairing = new HashSet();
to
private static pairing = Collections.synchronizedSet(new HashSet());

The problem disappeared with the change. The test lasted for more than 24 hours before
I interruped it.

Thanks,
June Zhong



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org