title: JMeter HTTP Request hangs (probably on overloaded network)
body: <p>I use JMeter tests to check that our applications are running. The tests are run from Jenkins thru ANT <code>&lt;jmeter&gt;</code> tag. The problem is, that <strong>JMeter time to time hangs forever</strong> (and Jenkins executor is blocked as still running). In two months (tests are run every 10minutes) just two such hangs occured, but today, two parallel test were stuck simultaneously (within 5minutes, different tests). I do suspect network connection (it is often overloaded and unreliable), but i want the tests to be reliable even in such environment.</p>
  
  <p>Thread dumps of stuck processes are:</p>
  
  <pre><code>   [jmeter] "User test 1-1" prio=10 tid=0x00007fd56c43f000 nid=0x2797 runnable [0x00007fd5704e2000]
     [jmeter]    java.lang.Thread.State: RUNNABLE
     [jmeter]     at java.net.SocketInputStream.socketRead0(Native Method)
     [jmeter]     at java.net.SocketInputStream.read(SocketInputStream.java:146)
     [jmeter]     at org.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:204)
     [jmeter]     at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:177)
     [jmeter]     at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:201)
     [jmeter]     at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:155)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.readResponse(HTTPSamplerBase.java:1649)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.readResponse(HTTPAbstractImpl.java:235)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:300)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.followRedirects(HTTPSamplerBase.java:1410)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.resultProcessing(HTTPSamplerBase.java:1481)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.resultProcessing(HTTPAbstractImpl.java:251)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:358)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1088)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1077)
     [jmeter]     at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:428)
     [jmeter]     at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
     [jmeter]     at java.lang.Thread.run(Thread.java:679)
  </code></pre>
  
  <p>and from the second test (this one tests reachability of www.google.com):</p>
  
  <pre><code>   [jmeter] "www.google.com 1-1" prio=10 tid=0x0000000000d32000 nid=0x27e8 runnable [0x00007fb9fea54000]
     [jmeter]    java.lang.Thread.State: RUNNABLE
     [jmeter]     at java.net.SocketInputStream.socketRead0(Native Method)
     [jmeter]     at java.net.SocketInputStream.read(SocketInputStream.java:146)
     [jmeter]     at org.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:204)
     [jmeter]     at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:177)
     [jmeter]     at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:201)
     [jmeter]     at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:155)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.readResponse(HTTPSamplerBase.java:1649)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.readResponse(HTTPAbstractImpl.java:235)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:300)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1088)
     [jmeter]     at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1077)
     [jmeter]     at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:428)
     [jmeter]     at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
     [jmeter]     at java.lang.Thread.run(Thread.java:679)
  </code></pre>
  
  <p>I Use <code>HTTP Request</code> Sampler with default values:</p>
  
  <pre><code>    &lt;HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="www.google.cz" enabled="true"&gt;
        &lt;elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"&gt;
          &lt;collectionProp name="Arguments.arguments"/&gt;
        &lt;/elementProp&gt;
        &lt;stringProp name="HTTPSampler.domain"&gt;www.google.cz&lt;/stringProp&gt;
        &lt;stringProp name="HTTPSampler.port"&gt;&lt;/stringProp&gt;
        &lt;stringProp name="HTTPSampler.connect_timeout"&gt;&lt;/stringProp&gt;
        &lt;stringProp name="HTTPSampler.response_timeout"&gt;&lt;/stringProp&gt;
        &lt;stringProp name="HTTPSampler.protocol"&gt;http&lt;/stringProp&gt;
        &lt;stringProp name="HTTPSampler.contentEncoding"&gt;&lt;/stringProp&gt;
        &lt;stringProp name="HTTPSampler.path"&gt;&lt;/stringProp&gt;
        &lt;stringProp name="HTTPSampler.method"&gt;GET&lt;/stringProp&gt;
        &lt;boolProp name="HTTPSampler.follow_redirects"&gt;true&lt;/boolProp&gt;
        &lt;boolProp name="HTTPSampler.auto_redirects"&gt;false&lt;/boolProp&gt;
        &lt;boolProp name="HTTPSampler.use_keepalive"&gt;true&lt;/boolProp&gt;
        &lt;boolProp name="HTTPSampler.DO_MULTIPART_POST"&gt;false&lt;/boolProp&gt;
        &lt;boolProp name="HTTPSampler.monitor"&gt;false&lt;/boolProp&gt;
        &lt;stringProp name="HTTPSampler.embedded_url_re"&gt;&lt;/stringProp&gt;
      &lt;/HTTPSamplerProxy&gt;
  </code></pre>
  
  <p>No timeout is set, but i experimented that the default timeout is 240s - when i try to <code>GET</code> from non-responding site, everything is OK and after 240s JMeter fails the task (as expected). </p>
  
  <p>JMeter version is 2.9 running on a linux machine.</p>
  
  <p>When I asked sysadmin about network, he said that it's was probably overloaded. I cannot reproduce the bug as it's happening so sparse (nor do i have TCP dump).</p>
  
  <p>I think about two possible workarounds:</p>
  
  <ul>
  <li>Add a timeout to JMeter to kill the problematic thread - <strong>I'm not sure how, any tips?</strong></li>
  <li>Add a timeout to Jenkins - using <a href="https://wiki.jenkins-ci.org/display/JENKINS/Build-timeout+Plugin" rel="nofollow">Build-timout plugin</a></li>
  </ul>
  
  <p>But <strong>I'd like to solve the problem, not to make workarounds.</strong>
  Do you have any suggestions?</p>
  
  <p>Threads are still stuck, can some useful information be extracted from them? I just used <code>kill -3 $PID</code> to get Thread dump.</p>