[
https://issues.apache.org/jira/browse/WW-5716?focusedWorklogId=1039590&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1039590
]
ASF GitHub Bot logged work on WW-5716:
--------------------------------------
Author: ASF GitHub Bot
Created on: 04/Sep/26 08:54
Start Date: 04/Sep/26 08:54
Worklog Time Spent: 10m
Work Description: sonarqubecloud[bot] commented on PR #1902:
URL: https://github.com/apache/struts/pull/1902#issuecomment-5538091985
## [](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1902)
**Quality Gate passed**
Issues
 [0 New
issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1902&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted
issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1902&issueStatuses=ACCEPTED)
Measures
 [0 Security
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=1902&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [93.8% Coverage on New
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1902&metric=new_coverage&view=list)
 [0.0% Duplication on New
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1902&metric=new_duplicated_lines_density&view=list)
<!
Issue Time Tracking
-------------------
Worklog Id: (was: 1039590)
Time Spent: 20m (was: 10m)
> Bound the per-locale definition caches in the Tiles plugin
> ----------------------------------------------------------
>
> Key: WW-5716
> URL: https://issues.apache.org/jira/browse/WW-5716
> Project: Struts 2
> Issue Type: Improvement
> Reporter: Lukasz Lenart
> Assignee: Lukasz Lenart
> Priority: Major
> Fix For: 6.12.0, 7.4.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The Tiles plugin caches parsed definitions per resolved {{Locale}} in two
> maps that grow without limit and are never reduced during the lifetime of the
> web application:
> *
> {{org.apache.tiles.core.definition.dao.CachingLocaleUrlDefinitionDAO#locale2definitionMap}}
> — a {{HashMap}} keyed by {{Locale}}, populated on each cache miss and never
> evicted. It is only cleared when {{checkRefresh}} is enabled and a refresh is
> required, and {{checkRefresh}} is {{false}} by default.
> *
> {{org.apache.tiles.core.definition.pattern.AbstractPatternDefinitionResolver#localePatternPaths}}
> — populated via {{computeIfAbsent}} per locale customization key and never
> swept.
> The {{TilesContainer}} that holds the DAO is stored in application scope, so
> both maps persist for the lifetime of the web application. With the default
> {{StrutsTilesLocaleResolver}}, the resolved locale comes from the
> {{ActionContext}} locale, which derives from {{request.getLocale()}}. In that
> setup the number of distinct cache keys is bounded only by the number of
> distinct locales encountered, and every new locale adds an entry that is
> retained indefinitely, so the caches' memory footprint grows over time with
> no upper bound.
> h3. Proposed change
> Bound both per-locale maps in the plugin's vendored Tiles code — for example
> a configurable maximum size with eviction — and ensure {{localePatternPaths}}
> is bounded/cleared alongside {{locale2definitionMap}}. Both maps sit on the
> same code path, so they must be bounded together; fixing only one leaves the
> other unbounded.
> h3. Notes
> * Affects every version that ships the Tiles plugin; the vendored caching DAO
> is unbounded across all of them.
> * Deployments that pin a fixed locale via {{struts.locale}}, or that enable
> {{struts.locale.validateRequestLocale=true}} (7.3.0+/6.11.0+), already
> constrain the key set. This change makes the plugin robust by default without
> requiring that configuration.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)