Project

General

Profile

Feature #60029

Tune Tomcat config to reduce CLOSE_WAIT sockets

Added by Alexey Bobyr almost 4 years ago. Updated about 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Alexey Bobyr
Category:
Tomcat 7
Target version:
Start date:
10/22/2015
Due date:
10/22/2015
% Done:

100%

Estimated time:
Operation System:
--

Description

from https://tomcat.apache.org/tomcat-7.0-doc/config/valve.html#Stuck_Thread_Detection_Valve

tuck Thread Detection Valve
Introduction
This valve allows to detect requests that take a long time to process, which might indicate that the thread that is processing it is stuck. Additionally it can optionally interrupt such threads to try and unblock them.

When such a request is detected, the current stack trace of its thread is written to Tomcat log with a WARN level.

The IDs and names of the stuck threads are available through JMX in the stuckThreadIds and stuckThreadNames attributes. The IDs can be used with the standard Threading JVM MBean (java.lang:type=Threading) to retrieve other information about each stuck thread.

Attributes
The Stuck Thread Detection Valve supports the following configuration attributes:

Attribute Description
className
Java class name of the implementation to use. This MUST be set to org.apache.catalina.valves.StuckThreadDetectionValve.

threshold
Minimum duration in seconds after which a thread is considered stuck. Default is 600 seconds. If set to 0, the detection is disabled.

Note: since the detection (and optional interruption) is done in the background thread of the Container (Engine, Host or Context) declaring this Valve, the threshold should be higher than the backgroundProcessorDelay of this Container.

interruptThreadThreshold
Minimum duration in seconds after which a stuck thread should be interrupted to attempt to "free" it.

Note that there's no guarantee that the thread will get unstuck. This usually works well for threads stuck on I/O or locks, but is probably useless in case of infinite loops.

Default is -1 which disables the feature. To enable it, the value must be greater or equal to threshold.

History

#1

Updated by Alex I about 3 years ago

  • Subject changed from enable StuckThreadDetectionValve with 40 min timeout it will force close leeked connections (leads to less CLOSE_WAIT connections) to Tune Tomcat config to recuce CLOSE_WAIT sockets
  • Operation System set to --
#2

Updated by Alex I about 3 years ago

  • Subject changed from Tune Tomcat config to recuce CLOSE_WAIT sockets to Tune Tomcat config to reduce CLOSE_WAIT sockets

Also available in: Atom PDF