Hi,
We are currently experimenting the following problem with JOnAS 2.1.1 :
We are creating lots of CMP Beans (about 20.000) of the same type.
The memory grows and grows until an OutOfMemoryError or something like
"Transaction inconsistency error" occurs.
When we run the EJBServer with -Xrunhprof, the HPJMeter shows that the
"JOnASMyBeanRemote_Stub", "JOnASMyBeanRemote", "JOnASMyBeanRemote_Skel"
and the "MyBeanPK" that are created are never removed from the memory.
The other objects "JOnASMyBeanHome", "JOnASMyBeanHome_Stub",
"JOnASMyBeanHome_Skel", "JOnASMyBean" are only instancied once and
that's ok with them.
Is there a problem with JOnAS or with GC ?
All the following systems have been tested and produces the same results
(with JOnAS 2.1.1) :
- HP-UX / JDK1.2.2 Hotspot / Sybase / RMI
- HP-UX / JDK1.2.2 Classic / Sybase / RMI
- Win NT / JDK1.2.2 Classic / Sybase / RMI
- Linux / JDK1.2.2 Classic / Sybase / RMI
- Linux / JDK1.2.2 Classic / Sybase / JEREMIE
- Linux / JDK1.3 HotSpot / Sybase / RMI
- Linux / JDK1.3 Classic / Sybase / RMI
- Linux / JDK1.3 HotSpot / Postgres / RMI
- Linux / JDK1.3 Classic / Postgres / RMI
Transaction attribute is "Mandatory".
Here is the code of the client :
---------------- Start of client code ------------------------------
public class JMeterClientTest
{
static InitialContext ctx = null;
static UserTransaction userTransaction = null;
static JMeterTestHome jMeterTestHome = null;
public static void main(String[] args) throws Exception
{
int limit = new Integer(args[0].trim()).intValue();
try
{
ctx = new InitialContext();
userTransaction =
(UserTransaction)PortableRemoteObject.narrow(ctx.lookup("javax.transaction.UserTransaction"),
UserTransaction.class);
jMeterTestHome = (JMeterTestHome)
PortableRemoteObject.narrow(ctx.lookup("JMeterTestHome"),
JMeterTestHome.class);
JMeterClientTest jmt = new JMeterClientTest();
System.out.println("debut create");
int ii = 0;
boolean encore = true;
while(encore)
{
System.out.println("create at " + ii);
jmt.doCreateTest(ii, "test jmeter ejb " + ii);
ii++;
if (ii >= limit) encore = false;
}
}
catch (Exception ex)
{
System.out.println("Error, rollback transaction ...");
ex.printStackTrace(System.err);
}
}
public void doCreateTest(int id, String body)throws Exception
{
JMeterTest jMeterTest = null;
userTransaction.begin();
jMeterTest = jMeterTestHome.create(id, body);
userTransaction.commit();
jMeterTest = null;
}
}
----------------End of client code -------------------------------
----------------Start of bean code -------------------------------
public class JMeterTestBean implements EntityBean
{
public int mId = 0;
public String mBody = null;
protected EntityContext mEntityContext = null;
public void setEntityContext (EntityContext ec) throws RemoteException
{
System.out.println("----------setEntity " + System.currentTimeMillis() +
" " + this );
mEntityContext = ec;
}
public void unsetEntityContext() throws RemoteException
{
System.out.println("-----------unsetEntity" + System.currentTimeMillis()
+ " " + this );
mEntityContext = null;
}
public JMeterTestPK ejbCreate(int id, String body) throws
CreateException
{
try
{
mId = id;
mBody = body;
}
catch(Exception ex)
{
throw new CreateException();
}
return null;
}
public void ejbPostCreate(int id, String body) throws CreateException
{
System.out.println("----------postCreate" + System.currentTimeMillis() +
" " + this );
}
public void ejbRemove() throws RemoveException
{
System.out.println("----------remove" + System.currentTimeMillis() + " "
+ this );
}
public void ejbLoad() throws RemoteException
{
System.out.println("----------load" + System.currentTimeMillis() + " " +
this );
}
public void ejbStore() throws RemoteException
{
System.out.println("----------store" + System.currentTimeMillis() + " "
+ this );
}
public void ejbPassivate() throws RemoteException
{
System.out.println("----------passivate" + System.currentTimeMillis() +
" " + this );
}
public void ejbActivate() throws RemoteException
{
System.out.println("----------activate" + System.currentTimeMillis() + "
" + this );
}
public int getId()
{
return mId;
}
public String getBody()
{
return mBody;
}
public void setId(int id)
{
mId = id;
}
public void setBody(String body)
{
mBody = body;
}
}
----------------End of bean code --------------------------------
----------------Start of pk code ---------------------------------
public class JMeterTestPK implements java.io.Serializable
{
public int mId;
public JMeterTestPK(int num)
{
mId = num;
}
public JMeterTestPK()
{
}
public int hashCode()
{
System.out.println(" --> [HASHCODE] pour : " + mId);
return mId;
}
public boolean equals(Object other)
{
System.out.println("--> [EQUALS] entre " + other + " et " + mId);
if (other instanceof JMeterTestPK)
{
JMeterTestPK otherPK = (JMeterTestPK) other;
if (otherPK.mId == mId)
{
return true;
}
}
return false;
}
public String toString()
{
Integer num = new Integer(mId);
return num.toString();
}
}
----------------End of pk code ----------------------------------
Thank you for your help.
Regards,
Olivier HEDIN
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".