jpalacios created SSHD-855:
------------------------------
Summary: CachingPublicKeyAuthenticator not clearing up closed
sessions
Key: SSHD-855
URL: https://issues.apache.org/jira/browse/SSHD-855
Project: MINA SSHD
Issue Type: Bug
Affects Versions: 1.7.0
Reporter: jpalacios
I'm currently investigating an incident in a production environment which
resulted in an {{OutOfMemoryError}}.
According to the heap dump we are seeing massive object graphs made up of
nested MINA's {{NioSocketSessions}}:
{code:java}
Thread -> ServerSessionImpl -> SshServer -> JohnsonAwarePublicKeyAuthenticator
-> CachingPublicKeyAuthenticator -> ConcurrentHashMap ->
ConcurrentHashMap$Node[] -> ConcurrentHashMap$Node -> ServerSessionImpl ->
MinaSession -> NioSocketSession -> SelectionKeyImpl -> EpollSelectorImpl ->
HashMap -> SelectionKeyImpl -> NioSocketSession -> ...
{code}
As you can see pass the first {{NioSocketSession}} the graph starts to repeat
itself. These are not loops however. These are all different instances with a
small shallow size but which add up to massive retained sizes. The
{{CachingPublicKeyAuthenticator}} in particular has a retained size of ~6GB.
Another interesting thing is that AFAICT out the 94K {{NioSocketSession}}
instances in the heap, 93983 have a closed channel and the
{{ServerSessionImpl}} that directly reference them is closed as well. 59 of
these {{ServerSessionImpl}} instances are directly referenced from the
{{cache}} map in {{CachingPublicKeyAuthenticator}}.
I'm still gathering information to understand the load the system was in at the
time of the incident, but I would appreciate your help in trying to understand
how this nested graph could be put together, and if there's a scenario in which
the {{CachingPublicKeyAuthenticator}} may fail to clear it's cached correctly.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)