tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 侯树成 <chain...@gmail.com>
Subject how http connector backlog attribute works?
Date Fri, 27 Dec 2013 07:09:14 GMT
Hi,
I find a problem of http bio connector,I need help.
You can find it in flowing steps:

1.set tomcat connector like this:
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" acceptCount="1" maxThreads="1"
minSpareThreads="1"/>

2. deploy a war file, which contains a servlet that will sleep 60s in it's
doPost method

3. use LR or JMeter send 5 requests to the serlvet above

4. use command jstack print current thread stack

NOTE: now the main acceptor thread stack like this:
"http-bio-8080-Acceptor-0" daemon prio=6 tid=0x04b49800 nid=0x1a88 waiting
on condition [0x0536f000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x29a06cd0> (a
org.apache.tomcat.util.threads.LimitLatch$Sync)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:156)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:811)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:969)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1281)
at
org.apache.tomcat.util.threads.LimitLatch.countUpOrAwait(LimitLatch.java:115)
at
org.apache.tomcat.util.net.AbstractEndpoint.countUpOrAwaitConnection(AbstractEndpoint.java:733)
at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:210)
at java.lang.Thread.run(Thread.java:662)

Now, In the 5 requests, 3 request will served correctly, but another 2
requests will received "Connection refused error" like this

Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)

Why the 2 requests not entering the thread pool executor or taskQueue, but
get refused quickly?

Thanks in advance.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message