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 bu...@apache.org on 2010/03/12 18:35:01 UTC

DO NOT REPLY [Bug 48901] New: Endless wait on Synchronizing Timer

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

           Summary: Endless wait on Synchronizing Timer
           Product: JMeter
           Version: 2.3.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTTP
        AssignedTo: jmeter-dev@jakarta.apache.org
        ReportedBy: joychester@gmail.com


All the threads will perform endless wait by adding Synchronizing Timer.

This issue is much easier reproduced under a heavy load. I was using 100
threads to a simple HTTP request sampler with adding a Synchronizing Timer,
Groupsize set to 100 as well.

please see the attachment which is the stack trace of 100 threads doing a
endless wait.

Some initial invstigation for this issue:

Here is the current source code:

public long delay() {
        synchronized (sync) {
            timerCounter[0]++;
            final int groupSz = getGroupSize();
            final int count = timerCounter[0];
            if (
                (groupSz == 0 && count >=
JMeterContextService.getNumberOfThreads())
                ||
                (groupSz > 0 && count >= groupSz)
                ) {
                sync.notifyAll();
            } else {
                try {
                    sync.wait();
                } catch (InterruptedException e) {
                    log.warn(e.getLocalizedMessage());
                }
            }
            timerCounter[0]=0; // Reset for next time
        }
        return 0;
    }

The main problem from my perspective is after one thread call sync.notifyAll();
,which means after the lock has been released,it will execute
timerCounter[0]=0;(correct me if i am wrong)

After chaning the code as following(move "timerCounter[0]=0;" in front of
"sync.notifyAll();", it does not impact any business impact, but make more
sense to me), and the issue disappear:
public long delay() {
        synchronized (sync) {
            timerCounter[0]++;
            final int groupSz = getGroupSize();
            final int count = timerCounter[0];
            if (
                (groupSz == 0 && count >=
JMeterContextService.getNumberOfThreads())
                ||
                (groupSz > 0 && count >= groupSz)
                ) {
                timerCounter[0]=0; // Reset for next time
                sync.notifyAll();
            } else {
                try {
                    sync.wait();
                } catch (InterruptedException e) {
                    log.warn(e.getLocalizedMessage());
                }
            }
        }
        return 0;
    }

Please review the code and make according changes with this issue. BTW,It can
be reproduced on 2.3.4 release as well.
Hope this helps!

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 48901] Endless wait by adding Synchronizing Timer

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

Cheng Chi <jo...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Endless wait on             |Endless wait by adding
                   |Synchronizing Timer         |Synchronizing Timer

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 48901] Endless wait by adding Synchronizing Timer

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

Sebb <se...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #2 from Sebb <se...@apache.org> 2010-03-15 18:23:24 UTC ---
Thanks for the report and suggested fix.

Applied in SVN:

URL: http://svn.apache.org/viewvc?rev=923374&view=rev
Log:
Bug 48901 - Endless wait by adding Synchronizing Timer

Modified:
   jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/SyncTimer.java
   jakarta/jmeter/trunk/xdocs/changes.xml

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 48901] Endless wait on Synchronizing Timer

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

--- Comment #1 from Cheng Chi <jo...@gmail.com> 2010-03-12 17:36:44 UTC ---
Created an attachment (id=25120)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25120)
Stack trace of 100 threads which is performing endless wait

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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