[PR] Make default value of StuckThreadDetectionValve#interru ptThreadThreshold explicit [tomcat]

lihongyi87 (via GitHub) <[email protected]> Sun, 02 Aug 2026 03:31:54 -0000
Newsgroups gmane.comp.jakarta.tomcat.devel
Message-ID <[email protected]>
lihongyi87 opened a new pull request, #1034:
URL: https://github.com/apache/tomcat/pull/1034

   The `interruptThreadThreshold` field of `StuckThreadDetectionValve` had no explicit initialiser, so it relied on the Java default of `0`. This value disables thread interruption.
   
   However, the Javadoc for the field (line 72) and the setter (line 118), as well as the user-facing documentation in `webapps/docs/config/valve.xml` (line 2677), all state that the default is `-1`:
   
   - `StuckThreadDetectionValve.java:72` — "In seconds. Default is -1 to disable interruption."
   - `StuckThreadDetectionValve.java:118` — "The default is -1."
   - `valve.xml:2677` — "Default is -1 which disables the feature."
   
   This patch makes the default explicit (`= -1`) so the code matches the documented behaviour.
   
   **Behaviour impact:** none. The interruption logic uses `interruptThreadThreshold > 0` (lines 190 and 222), so both `0` and `-1` disable the feature. This change only aligns the code with its documented default.
   
   **Testing:** the existing test (`TestStuckThreadDetectionValve`) calls `setInterruptThreadThreshold(5)` and does not rely on the default value, so it is unaffected.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]