You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Ruchi Goel <ru...@yahoo-inc.com> on 2010/03/24 06:11:37 UTC

Locking problems of SocketInputSteam at org.apache.commons.httpclient.HttpParser.readRawLine

Hi,
  We are using commons-httpclient-3.0.jar for one of our yahoo properties. The application is running on jetty.  In production, we are seeing the lock problems as follows :


btpool0-11554                                     runnable

      btpool0-11597 is waiting on this thread

      btpool0-11614 is waiting on this thread

        "btpool0-11554" prio=1 tid=0x0000002c0275f7c0 nid=0x4b62 runnable [0x0000000041f4a000..0x0000000041f4dab0]

            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.read(BufferedInputStream.java:235)

            - locked <0x0000002b0835ddf0> (a java.io.BufferedInputStream)

            at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)

            at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)

            at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)

            at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1373)

            at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)

            at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)

            at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)

            at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
            at

There are many instances of such thread lock areas in the thread dump.
Any pointers/help appreciated.

Regards,
Ruchi


RE: Locking problems of SocketInputSteam at org.apache.commons.httpclient.HttpParser.readRawLine

Posted by "Langston, Jim" <Ji...@compuware.com>.
Hi all,

 

Following up 

 

This turned out to be a red-herring , the threads that were connecting were getting

on and off the socket so fast that the thread dump always showed that the connection

was in the state of being locked. I had to move one step deeper into the code and 

look at the loop that was creating the connection and fix the problem there.

 

Thanks,

 

Jim

 

///////////////////////////////

 

Jim Langston

Technical Consultant

jim.langston@compuware.com

(313) 227-0407 (Office)

(513) 702-4741 (Cell)

 

From: Langston, Jim [mailto:Jim.Langston@compuware.com] 
Sent: Monday, April 18, 2011 3:33 PM
To: HttpClient User Discussion
Subject: RE: Locking problems of SocketInputSteam at org.apache.commons.httpclient.HttpParser.readRawLine

 

Thanks Oleg,

I have been reading up on some of the other responses, not sure why your

email didn’t come through correctly, but I did see the response in the archive.

soTimeout is set to 30000

ConnectionTimeout is set to 5000

Hitting the site from the browser, I never get any timeouts, it will sit with the 

dialogue box active. As soon as I hit the dialogue, the site will continue on. It 

can be 1 min or 2 days.

I was going to attempt to fix it in the app, but I don’t know if I can, tomcat shows

the thread active, even if I stop/kill the browser session. I need to restart tomcat

to clear it.

Jim

//////////////////////////////////

Jim Langston

Technical Consultant

jim.langston@compuware.com

(313) 227-0407 (Office)

(513) 702-4741 (Cell)

 



The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.


From: Oleg Kalnichevski [mailto:olegk@apache.org]
Sent: Monday, April 18, 2011 3:10 PM
To: HttpClient User Discussion
Subject: RE: Locking problems of SocketInputSteam at org.apache.commons.httpclient.HttpParser.readRawLine

 


RE: Locking problems of SocketInputSteam at org.apache.commons.httpclient.HttpParser.readRawLine

Posted by "Langston, Jim" <Ji...@compuware.com>.
Thanks Oleg,

I have been reading up on some of the other responses, not sure why your
email didn’t come through correctly, but I did see the response in the archive.

soTimeout is set to 30000

ConnectionTimeout is set to 5000

Hitting the site from the browser, I never get any timeouts, it will sit with the 
dialogue box active. As soon as I hit the dialogue, the site will continue on. It 
can be 1 min or 2 days.

I was going to attempt to fix it in the app, but I don’t know if I can, tomcat shows
the thread active, even if I stop/kill the browser session. I need to restart tomcat
to clear it.

Jim

//////////////////////////////////

Jim Langston
Technical Consultant
jim.langston@compuware.com
(313) 227-0407 (Office)
(513) 702-4741 (Cell)



The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.

From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: Monday, April 18, 2011 3:10 PM
To: HttpClient User Discussion
Subject: RE: Locking problems of SocketInputSteam at org.apache.commons.httpclient.HttpParser.readRawLine





RE: Locking problems of SocketInputSteam at org.apache.commons.httpclient.HttpParser.readRawLine

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2011-04-18 at 14:09 -0400, Langston, Jim wrote:
> Digging at this deeper, the problem is stemming from the client, which is
> a website that will bring up a popup, looking for a response. Normally, you
> would answer the popup and move on, but in this case, everything is being
> done programmatically, I can't answer the popup, so the thread sits and
> waits, won't close the connection, and no data moves back and forth, would
> moving to 4.x help ?
> 
> Jim
> 

Jim,

Regardless of the version one always should set a finite socket timeout,
precisely in order to avoid the I/O thread getting stuck indefinitely in
a read operation.

You should consider upgrading to 4.x primarily because 3.x line is no
longer supported. 

Oleg 




---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


RE: Locking problems of SocketInputSteam at org.apache.commons.httpclient.HttpParser.readRawLine

Posted by "Langston, Jim" <Ji...@compuware.com>.
Digging at this deeper, the problem is stemming from the client, which is
a website that will bring up a popup, looking for a response. Normally, you
would answer the popup and move on, but in this case, everything is being
done programmatically, I can't answer the popup, so the thread sits and
waits, won't close the connection, and no data moves back and forth, would
moving to 4.x help ?

Jim

///////////////////////////////////////////

Jim Langston
Technical Consultant
jim.langston@compuware.com
(313) 227-0407 (Office)
(513) 702-4741 (Cell)



The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.

From: Langston, Jim 
Sent: Monday, April 18, 2011 10:21 AM
To: HttpClient User Discussion
Cc: Sandeep Khunteta; Ycal-dev-blr@yahoo-inc.com
Subject: RE: Locking problems of SocketInputSteam at org.apache.commons.httpclient.HttpParser.readRawLine

Hi all, 

I’m in this exact scenario, the server seems to be sitting, waiting for a response, but not sending anything else, even after several hours;


is there a resolution to this? Can I set a timeout ? My sequence on the thread dump:

"Thread-23" daemon prio=10 tid=0x080a9000 nid=0x553e runnable [0xb3dba000]
   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.read(BufferedInputStream.java:237)
        - locked <0x3c90af40> (a java.io.BufferedInputStream)
        at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
        at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
        at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413)
        at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)
        at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
        at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)

Thanks 

Jim


///////////////////////

Jim Langston
Technical Consultant
jim.langston@compuware.com
(313) 227-0407 (Office)
(513) 702-4741 (Cell)


-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: Wednesday, March 24, 2010 11:18 AM
To: HttpClient User Discussion
Cc: Sandeep Khunteta; Ycal-dev-blr@yahoo-inc.com
Subject: Re: Locking problems of SocketInputSteam at org.apache.commons.httpclient.HttpParser.readRawLine

On Wed, 2010-03-24 at 10:41 +0530, Ruchi Goel wrote:
> Hi,
>   We are using commons-httpclient-3.0.jar for one of our yahoo properties. The application is running on jetty.  In production, we are seeing the lock problems as follows :
> 
> 
> btpool0-11554                                     runnable
> 
>       btpool0-11597 is waiting on this thread
> 
>       btpool0-11614 is waiting on this thread
> 
>         "btpool0-11554" prio=1 tid=0x0000002c0275f7c0 nid=0x4b62 runnable [0x0000000041f4a000..0x0000000041f4dab0]
> 
>             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.read(BufferedInputStream.java:235)
> 
>             - locked <0x0000002b0835ddf0> (a java.io.BufferedInputStream)
> 
>             at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)
> 
>             at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)
> 
>             at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)
> 
>             at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1373)
> 
>             at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
> 
>             at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
> 
>             at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
> 
>             at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
>             at
> 
> There are many instances of such thread lock areas in the thread dump.
> Any pointers/help appreciated.
> 

The thread is blocked in a read operation waiting for input. Apparently
the server is not sending data.

Oleg

> Regards,
> Ruchi
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


RE: Locking problems of SocketInputSteam at org.apache.commons.httpclient.HttpParser.readRawLine

Posted by "Langston, Jim" <Ji...@compuware.com>.
Hi all, 

I’m in this exact scenario, the server seems to be sitting, waiting for a response, but not sending anything else, even after several hours;


is there a resolution to this? Can I set a timeout ? My sequence on the thread dump:

"Thread-23" daemon prio=10 tid=0x080a9000 nid=0x553e runnable [0xb3dba000]
   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.read(BufferedInputStream.java:237)
        - locked <0x3c90af40> (a java.io.BufferedInputStream)
        at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
        at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
        at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413)
        at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)
        at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
        at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)

Thanks 

Jim


///////////////////////

Jim Langston
Technical Consultant
jim.langston@compuware.com
(313) 227-0407 (Office)
(513) 702-4741 (Cell)



The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.

From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: Wednesday, March 24, 2010 11:18 AM
To: HttpClient User Discussion
Cc: Sandeep Khunteta; Ycal-dev-blr@yahoo-inc.com
Subject: Re: Locking problems of SocketInputSteam at org.apache.commons.httpclient.HttpParser.readRawLine

On Wed, 2010-03-24 at 10:41 +0530, Ruchi Goel wrote:
> Hi,
>   We are using commons-httpclient-3.0.jar for one of our yahoo properties. The application is running on jetty.  In production, we are seeing the lock problems as follows :
> 
> 
> btpool0-11554                                     runnable
> 
>       btpool0-11597 is waiting on this thread
> 
>       btpool0-11614 is waiting on this thread
> 
>         "btpool0-11554" prio=1 tid=0x0000002c0275f7c0 nid=0x4b62 runnable [0x0000000041f4a000..0x0000000041f4dab0]
> 
>             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.read(BufferedInputStream.java:235)
> 
>             - locked <0x0000002b0835ddf0> (a java.io.BufferedInputStream)
> 
>             at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)
> 
>             at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)
> 
>             at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)
> 
>             at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1373)
> 
>             at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
> 
>             at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
> 
>             at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
> 
>             at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
>             at
> 
> There are many instances of such thread lock areas in the thread dump.
> Any pointers/help appreciated.
> 

The thread is blocked in a read operation waiting for input. Apparently
the server is not sending data.

Oleg

> Regards,
> Ruchi
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Locking problems of SocketInputSteam at org.apache.commons.httpclient.HttpParser.readRawLine

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2010-03-24 at 10:41 +0530, Ruchi Goel wrote:
> Hi,
>   We are using commons-httpclient-3.0.jar for one of our yahoo properties. The application is running on jetty.  In production, we are seeing the lock problems as follows :
> 
> 
> btpool0-11554                                     runnable
> 
>       btpool0-11597 is waiting on this thread
> 
>       btpool0-11614 is waiting on this thread
> 
>         "btpool0-11554" prio=1 tid=0x0000002c0275f7c0 nid=0x4b62 runnable [0x0000000041f4a000..0x0000000041f4dab0]
> 
>             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.read(BufferedInputStream.java:235)
> 
>             - locked <0x0000002b0835ddf0> (a java.io.BufferedInputStream)
> 
>             at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)
> 
>             at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)
> 
>             at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)
> 
>             at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1373)
> 
>             at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
> 
>             at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
> 
>             at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
> 
>             at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
>             at
> 
> There are many instances of such thread lock areas in the thread dump.
> Any pointers/help appreciated.
> 

The thread is blocked in a read operation waiting for input. Apparently
the server is not sending data.

Oleg

> Regards,
> Ruchi
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org