WebSphere Tutorial · Running WebSphere in Production · Lesson 21 of 23

Troubleshooting Hangs, Pool Exhaustion and Memory

Diagnosing the classic WebSphere incidents: hung threads (WSVR0605W), connection pool exhaustion (J2CA0045E) and OutOfMemoryError, with javacores, heapdumps and GC logs.

Members can save this page, take notes and track progress. See membership · Sign in

Hung threads: WSVR0605W

A thread ran longer than the hung-thread threshold (600 seconds by default). Take javacores (thread dumps) several times, 30-60 seconds apart (kill -3 <pid>, or server javadump on Liberty), and look for many threads in the same stack: waiting on a remote call without a timeout, a lock, or a loop.

Pool exhaustion: J2CA0045E

No connection became free within the timeout. Javacores show who holds connections (slow SQL, remote calls inside transactions, leaks); pool metrics show wait times. Fix the cause before raising the maximum.

OutOfMemoryError

A heapdump (.phd, written automatically by OpenJ9) analysed in Eclipse Memory Analyzer shows the biggest objects and what keeps them alive. Memory that grows after every redeploy is a class loader leak.

A routine for every incident

  1. Restore service (take the member out of rotation, restart) but collect evidence first: javacores, logs, FFDC, GC log.
  2. Correlate with changes and traffic.
  3. Fix the cause, add an alert for the early symptom, and write it down.
Grouping threads in a javacore to find the bottleneckTry it yourself
from collections import Counter

javacore = [  # top frame of each WebContainer thread in one dump
    "java.net.SocketInputStream.read (InventoryClient.getStock)",
    "java.net.SocketInputStream.read (InventoryClient.getStock)",
    "com.ibm.ejs.j2c.FreePool.queueRequest (OrderDao.save)",
    "java.net.SocketInputStream.read (InventoryClient.getStock)",
    "com.ibm.ejs.j2c.FreePool.queueRequest (OrderDao.save)",
    "sun.misc.Unsafe.park (idle)",
]
for frame, n in Counter(javacore).most_common():
    print(f"{n} threads  {frame}")
print("-> most threads wait on the inventory service: add a timeout and a circuit breaker")

Output

3 threads  java.net.SocketInputStream.read (InventoryClient.getStock)
2 threads  com.ibm.ejs.j2c.FreePool.queueRequest (OrderDao.save)
1 threads  sun.misc.Unsafe.park (idle)
-> most threads wait on the inventory service: add a timeout and a circuit breaker

Test yourself

Which artefact do you collect first for a hang?

  1. A heapdump
  2. Several javacores, 30-60 seconds apart
  3. plugin-cfg.xml
  4. An empty log
Show answer

Answer: Several javacores, 30-60 seconds apart

Comparing thread stacks over time shows what's stuck.

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake