You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rallavagu <ra...@gmail.com> on 2016/10/12 15:22:05 UTC

Long running socket reads

Tomcat 7.0.70 - Sun JDK 1.7.0_80

I have following long running thread (almost 5 sec). It appears to be 
reading data from socket (external resource potentially). Wonder how I 
could go about debug these kind of threads to understand which external 
resource is it spending more time on reading. Thank.

"http-bio-28080-exec-523" daemon prio=10 tid=0x00007fc5e403e000 
nid=0x3cbd runnable [0x00007fc51ce0d000]
    java.lang.Thread.State: RUNNABLE
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:152)
         at java.net.SocketInputStream.read(SocketInputStream.java:122)
         at 
org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:516)
         at 
org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:501)
         at 
org.apache.coyote.http11.Http11Processor.setRequestLineReadTimeout(Http11Processor.java:168)
         at 
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:994)
         at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)
         at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
         - locked <0x00000006e20ac9e8> (a 
org.apache.tomcat.util.net.SocketWrapper)
         at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
         at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
         at 
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
         at java.lang.Thread.run(Thread.java:745)

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


Re: Long running socket reads

Posted by Rallavagu <ra...@gmail.com>.

On 10/14/16 1:01 AM, Mark Thomas wrote:
> On 12/10/2016 16:22, Rallavagu wrote:
>> Tomcat 7.0.70 - Sun JDK 1.7.0_80
>>
>> I have following long running thread (almost 5 sec).
>
> No you don't. That thread isn't doing it any work. It is blocking,
> waiting for I/O.

Well, I got in impression because the thread shows as "RUNNABLE" in tow 
thread dumps in a row.

>
>> It appears to be reading data from socket
>
> Sort of correct. It is waiting for data to arrive.
I suppose it is waiting for the data to arrive from slow clients?

>
>> (external resource potentially).
>
> Wrong.
>
>> Wonder how I
>> could go about debug these kind of threads to understand which external
>> resource is it spending more time on reading. Thank.
>
> The stack trace contains class names and line numbers. The source code
> is freely available. While the class names themselves provide a broad
> hint as to what this thread is waiting for, you always have the option
> of looking at the source code.
>
> In this case start with these:
> AbstractHttp11Processor line 994
> Http11Processor         line 168

Here is what at line 168 of Http1Processor

if (!inputBuffer.fill()) {
                 throw new EOFException(sm.getString("iib.eof.error"));
             }

I couldnt make much out of this. But, I assume that this thread is 
waiting for client to finish sending the data?

Thanks for the response.

>
> Mark
>
>>
>> "http-bio-28080-exec-523" daemon prio=10 tid=0x00007fc5e403e000
>> nid=0x3cbd runnable [0x00007fc51ce0d000]
>>    java.lang.Thread.State: RUNNABLE
>>         at java.net.SocketInputStream.socketRead0(Native Method)
>>         at java.net.SocketInputStream.read(SocketInputStream.java:152)
>>         at java.net.SocketInputStream.read(SocketInputStream.java:122)
>>         at
>> org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:516)
>>
>>         at
>> org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:501)
>>
>>         at
>> org.apache.coyote.http11.Http11Processor.setRequestLineReadTimeout(Http11Processor.java:168)
>>
>>         at
>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:994)
>>
>>         at
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)
>>
>>         at
>> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
>>
>>         - locked <0x00000006e20ac9e8> (a
>> org.apache.tomcat.util.net.SocketWrapper)
>>         at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>>
>>         at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>>
>>         at
>> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>>
>>         at java.lang.Thread.run(Thread.java:745)
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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


Re: Long running socket reads

Posted by Mark Thomas <ma...@apache.org>.
On 12/10/2016 16:22, Rallavagu wrote:
> Tomcat 7.0.70 - Sun JDK 1.7.0_80
> 
> I have following long running thread (almost 5 sec).

No you don't. That thread isn't doing it any work. It is blocking,
waiting for I/O.

> It appears to be reading data from socket

Sort of correct. It is waiting for data to arrive.

> (external resource potentially).

Wrong.

> Wonder how I
> could go about debug these kind of threads to understand which external
> resource is it spending more time on reading. Thank.

The stack trace contains class names and line numbers. The source code
is freely available. While the class names themselves provide a broad
hint as to what this thread is waiting for, you always have the option
of looking at the source code.

In this case start with these:
AbstractHttp11Processor line 994
Http11Processor         line 168

Mark

> 
> "http-bio-28080-exec-523" daemon prio=10 tid=0x00007fc5e403e000
> nid=0x3cbd runnable [0x00007fc51ce0d000]
>    java.lang.Thread.State: RUNNABLE
>         at java.net.SocketInputStream.socketRead0(Native Method)
>         at java.net.SocketInputStream.read(SocketInputStream.java:152)
>         at java.net.SocketInputStream.read(SocketInputStream.java:122)
>         at
> org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:516)
> 
>         at
> org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:501)
> 
>         at
> org.apache.coyote.http11.Http11Processor.setRequestLineReadTimeout(Http11Processor.java:168)
> 
>         at
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:994)
> 
>         at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)
> 
>         at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
> 
>         - locked <0x00000006e20ac9e8> (a
> org.apache.tomcat.util.net.SocketWrapper)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> 
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> 
>         at
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> 
>         at java.lang.Thread.run(Thread.java:745)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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