Author: sebb
Date: Mon Sep 26 21:47:37 2011
New Revision: 1176077

URL: http://svn.apache.org/viewvc?rev=1176077&view=rev
Log:
Bug 51888 - Occasional deadlock when stopping a testplan

Modified:
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
    jakarta/jmeter/trunk/xdocs/changes.xml

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java?rev=1176077&r1=1176076&r2=1176077&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java 
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java 
Mon Sep 26 21:47:37 2011
@@ -23,6 +23,7 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.concurrent.locks.ReentrantLock;
 
 import org.apache.jmeter.assertions.Assertion;
 import org.apache.jmeter.assertions.AssertionResult;
@@ -127,6 +128,8 @@ public class JMeterThread implements Run
 
     private volatile Sampler currentSampler;
 
+    private final ReentrantLock interruptLock = new ReentrantLock(); // ensure 
that interrupt cannot overlap with shutdown
+
     public JMeterThread(HashTree test, JMeterThreadMonitor monitor, 
ListenerNotifier note) {
         this.monitor = monitor;
         threadVars = new JMeterVariables();
@@ -303,6 +306,8 @@ public class JMeterThread implements Run
         } catch (Error e) {// Make sure errors are output to the log file
             log.error("Test failed!", e);
         } finally {
+            currentSampler = null; // prevent any further interrupts
+            interruptLock.lock();  // make sure current interrupt is finished
             threadContext.clear();
             log.info("Thread finished: " + threadName);
             threadFinished(iterationListener);
@@ -577,6 +582,8 @@ public class JMeterThread implements Run
         if (samp instanceof Interruptible){
             log.warn("Interrupting: " + threadName + " sampler: " 
+samp.getName());
             try {
+                interruptLock.lock();
+                samp = currentSampler; // fetch again, to avoid possible lost 
overlap at shutdown
                 boolean found = ((Interruptible)samp).interrupt();
                 if (!found) {
                     log.warn("No operation pending");
@@ -584,6 +591,8 @@ public class JMeterThread implements Run
                 return found;
             } catch (Exception e) {
                 log.warn("Caught Exception interrupting sampler: 
"+e.toString());
+            } finally {
+                interruptLock.unlock();
             }
         } else if (samp != null){
             log.warn("Sampler is not Interruptible: "+samp.getName());

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1176077&r1=1176076&r2=1176077&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Mon Sep 26 21:47:37 2011
@@ -68,10 +68,6 @@ The menu item Options / Choose Language 
 To override the default local language fully, set the JMeter property 
"language" before starting JMeter. 
 </p>
 
-<p>When a test plan uses HttpClient 4 requests and you try to stop it before 
end of ramp up period,
-a possible deadlock may happen.
-</p>
-
 <h2>Incompatible changes</h2>
 
 <p>
@@ -89,6 +85,7 @@ httpclient3.retrycount=3
 <h3>HTTP Samplers and Proxy</h3>
 <ul>
 <li>Fix HttpClient 4 sampler so it reuses HttpClient instances and connections 
where possible.</li>
+<li>Temporary fix to HC4 sampler to work round HTTPCLIENT-1120.</li>
 <li>Bug 51863 - Lots of ESTABLISHED connections with HttpClient 4 
implementation (ws HttpClient 3.1 impl)</li>
 <li>Bug 51750 - Retrieve all embedded resources doesn't follow IFRAME</li>
 <li>Bug 51752 - HTTP Cache is broken when using "Retrieve all embedded 
resources" with concurrent pool</li>
@@ -144,6 +141,7 @@ httpclient3.retrycount=3
 <li>Bug 51855 - Parent samples may have slightly inaccurate elapsed times</li>
 <li>Bug 51880 - The shutdown command is not working if I invoke it before all 
the thread are started</li>
 <li>Remote Shut host menu item was not being enabled.</li>
+<li>Bug 51888 - Occasional deadlock when stopping a testplan</li>
 </ul>
 
 <!-- ==================================================== -->
@@ -191,6 +189,7 @@ httpclient3.retrycount=3
 <ul>
 <li>Bug 51822 - (part 1) save 1 invocation of GuiPackage#getCurrentGui</li>
 <li>Added AsynchSampleSender which sends samples from server to client 
asynchronously.</li>
+<li>Upgraded to htmlparser 2.1; JavaMail 1.4.4; JUnit 4.9</li>
 </ul>
 
 <h2>Non-functional changes</h2>
@@ -198,6 +197,7 @@ httpclient3.retrycount=3
 <li>Bug 49976 - FormCharSetFinder visibility is default instead of public. 
</li>
 <li>Bug 50917 - Property CookieManager.save.cookies not honored when set from 
test plan</li>
 <li>Improve error logging when Javascript errors are detected.</li>
+<li>Updated documentation footer</li>
 </ul>
 
 </section> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to