I am running into a weird problem and I think I might have found a bug in JBoss.
Some brief background first:
I am helping a company to migrate their application from WebLogic to JBoss. This application is a really BIG J2EE1.3 implementation that was running on WebLogic 5.1 and should now be running on JBoss 4.0.2.
The application is extensively using EJBs, especially SLSB's and BMP Entity Beans.
Synopsis of the observed issue:
After some time, the testers of the system observe data integrity issues. For example, when trying to add an new entity the DB complaints that some data already exists, although the entity attributes should still be emtpy, except for the ID! To make it clear: it does not complain that the ID is duplicate, but that some related unique data that is stored in one of the entity attribute already exists, although it should be empty!
After some more investigation, it appears that JBoss seems to re-use some entity from the pool but still having some data in its property.
We could show that this must be somehow related to the EntityInstancePool, since at first in standarjboss.xml we had the default setting in the BMP Container configuration:
After changing this setting to '30' we observed the same issue much earlier.
After that, we turned on TRACE logging for the system and ejb packages to see what is really going on. The issue seems to be related with one particular Entity Bean. Just before the faulty transaction, I noticed the following line in the log:
2006-07-26 14:23:10,858 TRACE [org.jboss.ejb.plugins.EntityInstancePool] Get instance org.jboss.ejb.plugins.EntityInstancePool@e9b75e#29#class <class name of bean>.
So, it appears to me that the instance pool had 29 elements and the error starts to occur the next time a new instance of that pool gets created, i.e. we should have now 'Maximum Size" elements in the pool!
However, when looking at the trace log before, I saw a couple of the following messages:
2006-07-26 14:12:45,194 TRACE [org.jboss.ejb.plugins.EntityInstancePool] 0/100 Free instance:org.jboss.ejb.plugins.EntityInstancePool@e9b75e#10143996#null#false#class <class name of bean>
For the "experts" of you, you will see that the second number after the "/" should show the maxSize of the EntityInstancePool! Well, we actually have set it to '30' when running this example!
So, I would like to know how exactly the variable maxSize in EntityInstancePool gets set and where the value comes from. I also would like to know how the InstancePool and InstanceCache actually work together.
Thanks for any reply!