https://bz.apache.org/bugzilla/show_bug.cgi?id=70296
Bug ID: 70296
Summary: Metric gets broken when tomcat_cache_access_total hits
Max int
Product: Tomcat 11
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Connectors
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: -------
Steps to Reproduce:
Run a Tomcat instance with metrics collection enabled.
Sustain high traffic on a long-lived pod until StringCache receives more than
Integer.MAX_VALUE (2,147,483,647) requests.
Expected Behavior:
Metrics collection should continue functioning normally and accurately report
cache accesses and hits beyond 2.14 billion requests.
Actual Behavior:
Upon reaching 2,147,483,647 requests, metrics collection fails. [Optional: Add
a sentence here noting if it throws a specific Exception, returns negative
values, or simply stops updating, along with any relevant stack trace].
Root Cause & Proposed Fix:
The access counter is defined as an int rather than a long, leading to an
integer overflow.
Package: org.apache.tomcat.util.buf.StringCache.java
File:
https://github.com/apache/tomcat/blob/11.0.27/java/org/apache/tomcat/util/buf/StringCache.java#L121
Line: 121
Simply changing the type of accessCount (and likely hitCount) from int to long
should resolve this issue.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]