[ 
https://issues.apache.org/jira/browse/JAMES-3620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17388528#comment-17388528
 ] 

tuister commented on JAMES-3620:
--------------------------------

The created timer will be hold by com.codahale.metrics.MetricRegistry#metrics 
for each name.
{code:java}
// com.codahale.metrics.MetricRegistry#metrics
private final ConcurrentMap<String, Metric> metrics;
{code}
Because of wrong command, the name will be random(like SMTP-FADLFAJDSF), so the 
size of metrics will be increasing continuously, and causing memory leak 
finally.

NOTICE: The line below will not remove metric from metrics,
{code:java}
timeMetric.stopAndPublish();
{code}
If you want to reproduct the memory leak, just send a large number of wrong 
commands to James smtp server, and observe the size of 
com.codahale.metrics.MetricRegistry#metrics, you can get it.

> Memory leak at org.apache.james.protocols.smtp.core.AbstractHookableCmdHandler
> ------------------------------------------------------------------------------
>
>                 Key: JAMES-3620
>                 URL: https://issues.apache.org/jira/browse/JAMES-3620
>             Project: James Server
>          Issue Type: Improvement
>          Components: protocols, SMTPServer
>            Reporter: tuister
>            Priority: Blocker
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> For each command, the command handler will use a timer record the rt. So, if 
> someone input error commands, the command handler will create a new timer to 
> record, this will cause memory leak.
> {code:java}
> //AbstractHookableCmdHandler#onCommand
> //see also org.apache.james.protocols.smtp.core.UnknownCmdHandler
> TimeMetric timeMetric = metricFactory.timer("SMTP-" + 
> request.getCommand().toLowerCase(Locale.US));{code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to