The YourKit profiler is used to analyze snapshot.
Steps that have been performed (for the only user):
- generation number has been increased.
- some actions on the application page have been done. most of them get entities and display them via jstl forEach tag.
- the logout has been performed (session.invalidate())
- the session timeout is set to 5 minutes. consequently I've waited for 6-8 minutes to make sure everything in session is invalidated.
- the snapshot via YourKit profiler was made.
What I've discovered:
SomeEntity
#3: Captured snapshot JBoss-2014-10-07-1.snapshot 11m 37s - 21m 43s 183 4392 7896
<All the objects> 183 7896
java.lang.Object[] 182 7832
java.util.ArrayList 182 7832
somePath.someImpl 167 7208
java.lang.Object[] 164 7016
java.util.ArrayList 164 7016
org.apache.taglibs.standard.tag.rt.core.ForEachTag 164 7016
somePath.someAnotherImpl 3 192
java.lang.Object[] 3 192
java.util.ArrayList 3 192
org.apache.taglibs.standard.tag.rt.core.ForEachTag 3 192
What we can see here (please fix me, if I'm wrong) the ForEachTag tag holds 164+3 instances of SomeEntity. I've investigated jstl issues and found that the problem had been reproduced. For example here, and here.
But at first it's said that don't nullable objects is in the doEndTag is ok, according to jsp spec (please fix me if I'm wrong). And second some problems have been resolved in the last 1.2 jstl version. In jBoss 7 the 1.2 version is used, so, it seems the problem still exists.
One of solution - to nullable objects in the doEndTag() considered as a bad practice. See here the reason
Next, I've repeated the actions that are described previously by 4 different users. I could find that the number of object that are hold by org.apache.taglibs.standard.tag.rt.core.ForEachTag is now 539+12.
As for me, - it's a memory leak. If I'm wrong, please fix me. If not what can we do in this case? To nullable objects in the doEndTag method?
I don't have an answer for you, but we're seeing something very similar with Jboss 6 and the foreach tag. We're continuing to investigate (when I found your post) and will let you know if we find anything.
--- EDIT ---
We added this fix, which resolved another memory leak issue, and seems to have resolved the foreach one as well.
For Jboss, we updated:
I believe this was in the standalone.xml file.