Issue Details (XML | Word | Printable)

Key: NUCJPA-279
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Brendan Humphreys
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus API JPA

JPAQuery.setHint("javax.persistence.loadgraph", graph) leaks FetchPlans.

Created: 22/Aug/14 11:14 AM   Updated: 22/Aug/14 02:31 PM
Component/s: API
Affects Version/s: 4.0.1
Fix Version/s: None

Severity: Production


 Description  « Hide
I believe there is a memory leak associated with the use of {{JPAQuery.setHint("javax.persistence.loadgraph", graph)}}.

The FetchGroupManager associated with the PersistenceNucleusContext accumulates FetchPlans as planListeners; they aren't deregistered on entityManager.close()

I've created a failing testcase here: https://github.com/pandacalculus/test-jpa.git

This means a FetchPlan is leaked every time a query using an entityGraph is executed.






Brendan Humphreys added a comment - 22/Aug/14 11:28 AM - edited
This is hitting us in production, as can be seen by the following chart:
https://dl.dropboxusercontent.com/s/ly4gtblfpc81tvf/2014-08-22%20at%207.15%20pm.png

Andy Jefferson added a comment - 22/Aug/14 12:51 PM
If its hitting you in production then I strongly suggest you get the code (GitHub) and work out the problem.

Brendan Humphreys added a comment - 22/Aug/14 01:21 PM
Thanks Andy,

As it happens we reboot service nodes with enough regularity that this issue hasn't derailed us yet. I haven't had a chance to dig into the DN codebase to see where a fix might be applied, but a viable workaround is to reset the FetchPlan manually after it has been executed:

((JPAQuery)query).getFetchPlan().setGroup(FetchPlan.DEFAULT);


Andy Jefferson made changes - 22/Aug/14 02:31 PM
Field Original Value New Value
Priority Critical [ 2 ] Major [ 3 ]