title: HttpURLConnection getting locked
body: <p>I have a thread running under tomcat which creates a HttpUrlConnection and reads it through BufferedInputStream.</p>
  
  <p>After fetching data for some urls, it stalls. I got the jstack of the process which says HttpUrlConnection is locked and BufferedInputStream is also locked.</p>
  
  <pre><code>"http-8080-1" daemon prio=10 tid=0x08683400 nid=0x79c9 runnable [0x8f618000]
     java.lang.Thread.State: RUNNABLE
          at java.net.SocketInputStream.socketRead0(Native Method)
          at java.net.SocketInputStream.read(SocketInputStream.java:129)
          at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
          at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
          at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
          - locked &lt;0x956ef8c0&gt; (a java.io.BufferedInputStream)
          at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
          at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1072)
          - locked &lt;0x956ef910&gt; (a sun.net.www.protocol.http.HttpURLConnection)
  </code></pre>
  
  <p>Could somebody help here.
  Thanks</p>