Suspected memleak caused by bad state of EntityManager

#1

Our application manages the Entities itself, so we close the EntityManager after every creating and using. We find a slow memleak in our application recently, and by trace of Entity construct and finalize, we found the problem is caused by bad state of EntityManager. After first throwing the InternalException, the EntityManager throws every time when doing merge operation, but it can be closed and retrieved by EntityManagerFactory, and the instances of Entity constructed by ObjectDB can never be released by JVM.There is a chart describes the instances exists in memory. We had checked the heap dump and found the numerous instances were referenced by ObjectDB. ([ObjectDB 2.3.6_14])

com.objectdb.o.InternalException: Unexpected internal exception
        at com.objectdb.o.JPE.h(JPE.java:163) ~[JPE.class:na]
        at com.objectdb.o.ERR.f(ERR.java:69) ~[ERR.class:na]
        at com.objectdb.o.OBC.onObjectDBError(OBC.java:1493) ~[OBC.class:na]
        at com.objectdb.jpa.EMImpl.rollback(EMImpl.java:295) ~[EMImpl.class:na]
        at com.app.dao.impl.ObjectdbExpeditionDAO.batchUpdateExpedition(ObjectdbExpeditionDAO.java:122) ~[ObjectdbExpeditionDAO.class:na]
        at com.app.ExpeditionManager.updateAllExpeditions(ExpeditionManager.java:287) [ExpeditionManager.class:na]
        at com.app.ExpeditionManager.run(ExpeditionManager.java:390) [ExpeditionManager.class:na]
        at java.lang.Thread.run(Thread.java:619) [na:1.6.0_21]
java.lang.NullPointerException: null
image/jpeg iconchart1.jpg (50.4KB)
chart1.jpg (Entity count in memory, our application only references about 2000 instances)
#2

More details are needed to understand this problem.

The stack trace is not full - the cause (NullPointerException) appears with no stack trace.

The connection between the stack trace and the memory consumption is unclear.

To demonstrate a memory issue you will have to provide a heap dump.

If possible - the problem should be demonstrated by a simple test case (see these instructions).

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

Here is the full stack trace: 

com.objectdb.o.InternalException: Unexpected internal exception
        at com.objectdb.o.JPE.h(JPE.java:163) ~[JPE.class:na]
        at com.objectdb.o.ERR.f(ERR.java:69) ~[ERR.class:na]
        at com.objectdb.o.OBC.onObjectDBError(OBC.java:1493) ~[OBC.class:na]
        at com.objectdb.jpa.EMImpl.clear(EMImpl.java:414) ~[EMImpl.class:na]
        at com.app.dao.impl.ObjectdbExpeditionDAO.batchUpdateExpedition(ObjectdbExpeditionDAO.java:127) ~[Objectdb
ExpeditionDAO.class:na]
        at com.app.ExpeditionManager.updateAllExpeditions(ExpeditionManager.java:287) [ExpeditionManager.class:na]
        at com.app.ExpeditionManager.run(ExpeditionManager.java:390) [ExpeditionManager.class:na]
        at java.lang.Thread.run(Thread.java:619) [na:1.6.0_21]
Caused by: java.lang.NullPointerException: null
        at com.objectdb.o.OBC.ax(OBC.java:500) ~[OBC.class:na]
        at com.objectdb.o.STA.ae(STA.java:812) ~[STA.class:na]
        at com.objectdb.o.STM.D(STM.java:373) ~[STM.class:na]
        at com.objectdb.o.OBC.ad(OBC.java:216) ~[OBC.class:na]
        at com.objectdb.jpa.EMImpl.clear(EMImpl.java:411) ~[EMImpl.class:na]
        ... 4 common frames omitted

#4

A new build (2.3.6_15) with an attempt to fix the NullPointerException was just uploaded.

However, the fix is local, and possibly the problem still exists and a test case will be needed.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login