1

I am creating a lag of 1.5 sec with chaos monkey to simulate a network delay. The test has 100 parallel users continuously calling an end-point which requires Database access.

During the testing I see a lot of InterruptedException from Tomcat Jdbc version 8.5.

The stack trace is as following:

  "Caused by: java.lang.InterruptedException",

  "\tat java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1039)",
  "\tat java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1328)",
  "\tat java.util.concurrent.CountDownLatch.await(CountDownLatch.java:277)",
  "\tat org.apache.tomcat.jdbc.pool.FairBlockingQueue.poll(FairBlockingQueue.java:157)",
  "\tat org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:707)",

It seems that during the wait for borrowing the connection, Tomcat Jdbc or some thread is interrupting the thread.

Our configuration is as following:

defaultAutoCommit=true
initialSize=2
maxActive=8
maxIdle=4
minIdle=2
maxWait=60000
testOnReturn=false
testOnBorrow=true
timeBetweenEvictionRunsMillis=10000
minEvictableIdleTimeMillis=30000
logAbandoned=true

Notably when I change the testOnBorrow to false, these exceptions go off.

Further to get more details, I started logging the activeThreads, idleThreads, waitingThreads and time spent to get the connection.

The logged data looks too cryptic to me to understand anything. But here is the key observation:

  1. I never see time spent to get the connection more than 40 seconds. Though the maxWait is 60 seconds. Ideally in case of failure the thread should spend 60 seconds waiting.

  2. Many a times I see that activeThreads are 1 or 0, idleThreads are again 1 or 2 and waitingThreads are 75 or so...and after sometime the waitingThreads becomes 0.

Kumar
  • 1,536
  • 2
  • 23
  • 33
  • I didn't get the whole question. What is actual issue that you are facing currently ? – Anish B. Sep 13 '22 at 17:11
  • 1
    @AnishB.: I am getting `java.lang.InterruptedException` while trying to borrow connection when there is slow network created by Chaos Monkey... – Kumar Sep 16 '22 at 08:01
  • 1
    I will try to answer this by tomorrow. I understood the question. – Anish B. Sep 16 '22 at 08:29
  • @AnishB.: Can you please provide some insights! I am still facing the issue. Thanks in advance! – Kumar Sep 21 '22 at 15:58

0 Answers0