[jboss-jira] [JBoss JIRA] (WFLY-9849) Hibernate session related leak on module undeployment
Scott Marlow (JIRA)
issues at jboss.org
Wed May 30 11:05:00 EDT 2018
[ https://issues.jboss.org/browse/WFLY-9849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13584449#comment-13584449 ]
Scott Marlow commented on WFLY-9849:
------------------------------------
I'm currently looking at wildfly-leak-2.hprof with the [https://www.eclipse.org/mat/] tool.
In the Histogram view, I filtered on the name of the leaked class "org.hibernate.internal.SessionFactoryImpl" and see that we have four objects with name=HibernateTestPU:
{code}
Class Name | Objects | Shallow Heap | Retained Heap
------------------------------------------------------------------------------------------------------
org.hibernate.internal.SessionFactoryImpl$3 | 0 | 0 |
org.hibernate.internal.SessionFactoryImpl$2 | 0 | 0 |
org.hibernate.internal.SessionFactoryImpl$1IntegratorObserver| 4 | 96 | >= 416
org.hibernate.internal.SessionFactoryImpl$1 | 0 | 0 |
org.hibernate.internal.SessionFactoryImpl | 4 | 544 | >= 797,032
------------------------------------------------------------------------------------------------------
{code}
One of the paths to SessionFactoryImpl shows:
{code}
Class Name | Ref. Objects | Shallow Heap | Ref. Shallow Heap | Retained Heap
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
org.jboss.msc.service.ServiceContainerImpl$ServiceThread @ 0xe0103d28 MSC service thread 1-5 Thread | 1 | 128 | 136 | 4,168
'- container org.jboss.msc.service.ServiceContainerImpl @ 0xe0486e20 | 1 | 104 | 136 | 26,576
'- registry java.util.concurrent.ConcurrentHashMap @ 0xe0487078 | 1 | 64 | 136 | 25,408
'- table java.util.concurrent.ConcurrentHashMap$Node[1024] @ 0xe06a5cb8 | 1 | 4,112 | 136 | 25,328
'- [820] java.util.concurrent.ConcurrentHashMap$Node @ 0xe1059098 | 1 | 32 | 136 | 64
'- next java.util.concurrent.ConcurrentHashMap$Node @ 0xe17b8638 | 1 | 32 | 136 | 32
'- val org.jboss.msc.service.ServiceRegistrationImpl @ 0xe13da8a8 | 1 | 40 | 136 | 104
'- instance org.jboss.msc.service.ServiceControllerImpl @ 0xe194f4c8 | 1 | 120 | 136 | 912
'- serviceValue org.jboss.msc.value.ImmediateValue @ 0xe194f540 | 1 | 16 | 136 | 16
'- value org.jboss.as.jpa.service.PersistenceUnitServiceImpl @ 0xe194f550 | 1 | 80 | 136 | 424
'- entityManagerFactory org.hibernate.jpa.internal.EntityManagerFactoryImpl @ 0xe194f9b8| 1 | 56 | 136 | 5,728
'- sessionFactory org.hibernate.internal.SessionFactoryImpl @ 0xe18b84c0 | 1 | 136 | 136 | 122,728
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{code}
It seems like the org.jboss.as.jpa.service.PersistenceUnitServiceImpl that references the HibernateTestPU didn't getting stopped at undeployment time.
Could you please try [enabling TRACE logging for org.jboss.as.jpa|http://docs.wildfly.org/12/Developer_Guide.html#troubleshooting] and attach the standalone/log/server.log that shows application deployment and undeployment of the HibernateLeakTest jar. I'm looking to see if an error occurred during undeployment that might help us understand what happened.
> Hibernate session related leak on module undeployment
> -----------------------------------------------------
>
> Key: WFLY-9849
> URL: https://issues.jboss.org/browse/WFLY-9849
> Project: WildFly
> Issue Type: Bug
> Affects Versions: 11.0.0.Final, 12.0.0.Final
> Environment: * Ubuntu 16.04.3 LTS
> * OpenJDK 1.8.0_151
> * Wildfly 11.0.0.Final
> Seems to occur at least on CentOS 7/OpenJDK 1.8.0_151 also.
> Reporter: Joni Syri
> Assignee: Scott Marlow
>
> In some cases it seems that removing deployment from the Wildfly, doesn't free up {{org.hibernate.internal.SessionFactoryImpl}}- instance related to the deployment. (plus some other Hibernate related classes). This can be seen by taking memory dump with VisualVM and looking up {{SessionFactoryImpl}} instances.
> This leads to cumulative memory leak in cases, where application is repeatedly deployed/undeployed (or updated).
> updated: Seems to occur on 12.0.0.Final also
> Memory dumps can be found at https://drive.google.com/drive/folders/1WbHB6hRpr_lrc4yb4yxWLpeObmJlNCzD (wildfly-leak-1 is after first deployment, wildfly-leak-2 after few re-deploys)
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the jboss-jira
mailing list