Bugs item #588241, was opened at 2002-07-29 13:38
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=588241&group_id=22866

Category: JBossServer
Group: None
>Status: Closed
Resolution: Invalid
Priority: 5
Submitted By: Joe Simone (jsimone)
Assigned to: Nobody/Anonymous (nobody)
Summary: Out-of-memory Exception 

Initial Comment:
OS:  WinXP Pro
JDK ver: 1.3.1_04-b02

This occurs in Both 3.0.0 final and 3.0.1RC1. Each 
iteration creates 10 CMP 2.0 entity beans and returns. 
So we get the memory exception after creating about 
14,510 entities.

Below is the relevant client code and its result:


int totalPasses = 10000;
for (int pass=1; pass <= totalPasses; pass++) {
// Create a bunch of sample data using the event 
manager interface ...
messageBox("CREATE SAMPLE 
EVENTS", "Pass "+pass+" of "+totalPasses, " ");
eventIds = eventManager.createSampleEvents(10);
}


[java] ------------------------------------------------------
[java] --- CREATE SAMPLE EVENTS
[java] --- Pass 1451 of 10000
[java] --- Current Time: Sun Jul 28 18:14:18 EDT 2002
[java] ------------------------------------------------------

[java] java.rmi.ServerException: RemoteException 
occurred in server thread; nested exception is:
[java] java.rmi.ServerException: null; nested exception 
is:
[java] java.lang.OutOfMemoryError
[java] Embedded Exception
[java] null; nested exception is:
[java] java.lang.OutOfMemoryError; nested exception is:
[java] javax.ejb.TransactionRolledbackLocalException: 
null; nested exception is:
[java] java.lang.OutOfMemoryError
[java] Embedded Exception
[java] null; nested exception is:
[java] java.lang.OutOfMemoryError
[java] java.rmi.ServerException: null; nested exception 
is:
[java] java.lang.OutOfMemoryError
[java] Embedded Exception
[java] null; nested exception is:
[java] java.lang.OutOfMemoryError; nested exception is:
[java] javax.ejb.TransactionRolledbackLocalException: 
null; nested exception is:
[java] java.lang.OutOfMemoryError
[java] Embedded Exception
[java] null; nested exception is:
[java] java.lang.OutOfMemoryError
[java] javax.ejb.TransactionRolledbackLocalException: 
null; nested exception is:
[java] java.lang.OutOfMemoryError
[java] Embedded Exception
[java] null; nested exception is:
[java] java.lang.OutOfMemoryError
[java] at 
sun.rmi.transport.StreamRemoteCall.exceptionReceived
FromServer(StreamRemoteCall.java:240)
[java] at 
sun.rmi.transport.StreamRemoteCall.executeCall
(StreamRemoteCall.java:215)
[java] at sun.rmi.server.UnicastRef.invoke
(UnicastRef.java:117)
[java] at 
org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invok
e(Unknown Source)
[java] at 
org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.i
nvoke(JRMPInvokerProxy.java:128)
[java] at org.jboss.invocation.InvokerInterceptor.invoke
(InvokerInterceptor.java:108)
[java] at org.jboss.proxy.TransactionInterceptor.invoke
(TransactionInterceptor.java:73)
[java] at org.jboss.proxy.SecurityInterceptor.invoke
(SecurityInterceptor.java:76)
[java] at 
org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke
(StatelessSessionInterceptor.java:111)
[java] at org.jboss.proxy.ClientContainer.invoke
(ClientContainer.java:76)
[java] at $Proxy1.createSampleEvents(Unknown Source)
[java] at com.highnotes.ebu.client.test.Stress_2.main
(Stress_2.java:91)
[java] 
javax.transaction.TransactionRolledbackException: null; 
nested exception is:
[java] java.lang.OutOfMemoryError
[java] java.lang.OutOfMemoryError
[java] <<no stack trace available>>



An additional point is that if the entities are immediately 
removed after creation, NO memory exception occurs. 
In fact, I have had this test case running for almost 36 
hours straight with no signs of distress.

Below is the relevant code from the client and its result:


int totalPasses = 10000;
for (int pass=1; pass <= totalPasses; pass++) {
// Create a bunch of sample data using the event 
manager interface ...
messageBox("CREATE SAMPLE 
EVENTS", "Pass "+pass+" of "+totalPasses, " ");
eventIds = eventManager.createSampleEvents(10);
Iterator iter = eventIds.iterator();
while (iter.hasNext()) {
eventManager.removeEvent((String) iter.next());
}
}


[java] ------------------------------------------------------
[java] --- TEST COMPLETE
[java] --- Pass 10000 of 10000, Total elapsed time: 0 
days 0 hrs 26 mins 32 secs
[java] --- Current Time: Sun Jul 28 18:53:08 EDT 2002
[java] ------------------------------------------------------




The session facade has "RequiresNew" as the 
transaction attribute and each of the entity bean 
methods has "Required".

My expectation is that when the client invokes:

eventIds = eventManager.createSampleEvents(10);

that the createSampleEvents method of the 
eventManager Session bean WILL create a new 
transaction. Then, that 10 entity beans will be created 
under that transaction. Finally, when the 
createSampleEvents method returns to the client the 
transaction will be complete and a commit will be 
performed for the 10 enities created.

I don't see any evidence of this happening.
Shouldn't I be seeing SQL COMMITS in the server.log?


See ref link :
http://www.jboss.org/forums/thread.jsp?
forum=46&thread=18548

----------------------------------------------------------------------

Comment By: Joe Simone (jsimone)
Date: 2002-07-30 10:31

Message:
Logged In: YES 
user_id=586242

More data ...

Stopped and started container with max-capacity 100k, reran 
test = death
Stopped and started container with max-capacity 50k, reran 
test = death at almost the same place
Stopped and started container with max-capacity 20k, reran 
test = death at almost the same place

Stopped and started container with max-capacity 10k, reran 
test = PASSED after much disk activity as previously noted.

By the way,  if I remove the beans after I create a batch of 
10, as noted in the initial bug report, then the out-of-memory 
condition does not occur.  In fact I only found the problem 
after taking away the remove in the loop.

Thanks for your help!  It is appreciated.

joe


----------------------------------------------------------------------

Comment By: Scott M Stark (starksm)
Date: 2002-07-30 10:29

Message:
Logged In: YES 
user_id=175228

So you realize that your test is effectively:

HashMap entityCache = ...
while( iter.hasMore() )
        entityCache.put(entity);

and what Bill is telling you is that we will let you create
1,000,000 entities with all their data brought into memory,
so do the math and figure out how much memory you need. 
By
dropping the max-capacity you lowering the point at which 
the
app server starts paging out the entity cache to disk, just
the same as an OS starts swapping memory to disk when 
your
app tries to use too much memory. Read the EJB spec about
the entity life-cycle and caching.

Then go and get the docs subscription to read about how you
can write your own caching policies, optimize loading, etc.


----------------------------------------------------------------------

Comment By: Joe Simone (jsimone)
Date: 2002-07-30 09:45

Message:
Logged In: YES 
user_id=586242

Bill,

Thanks for the prompt reply.  I lowered the limit from 1 million 
to 10 thousand for <max-capacity> in 11 places in the 
standardjboss.xml file.  I also removed the -Xmx256M from 
the run.bat file I had previously put in.

The stress test passed successfull after 20 minutes:
    [java] ------------------------------------------------------
    [java] --- TEST COMPLETE
    [java] --- Pass 10000 of 10000,  Total elapsed time:  0 
days 0 hrs 20 mins 16 secs
    [java] --- Current Time:  Tue Jul 30 12:27:22 EDT 2002
    [java] ------------------------------------------------------

There was alot of disk activity though, but it did finish.  With 
the capacity set high I get kinda blip, blip, blip disk activity.  
With the capacity set lower I get grind, blip, grind, grind, blip 
activity.  And it takes much longer, but it passes.

Just to double check I replaced the original 
standardjboss.xml that came with 3.0.0 and re-ran the same 
exact test after stopping and starting the container fresh and 
sure enough Out-of-memory:

    [java] ------------------------------------------------------
    [java] --- CREATE SAMPLE EVENTS
    [java] --- Pass 1438 of 10000
    [java] --- Current Time:  Tue Jul 30 12:40:29 EDT 2002
    [java] ------------------------------------------------------
    [java] java.rmi.ServerException: RemoteException 
occurred in server thread; nested exception is:
    [java]     java.rmi.ServerException: null; nested exception 
is:
    [java]     java.lang.OutOfMemoryError
    [java] Embedded Exception
    [java] null; nested exception is:
    [java]     java.lang.OutOfMemoryError; nested exception is:
    [java]     javax.ejb.TransactionRolledbackLocalException: 
null; nested exception is:
    [java]     java.lang.OutOfMemoryError
    [java] Embedded Exception
    [java] null; nested exception is:
    [java]     java.lang.OutOfMemoryError

etc. ...


regards,
joe

----------------------------------------------------------------------

Comment By: Bill Burke (patriot1burke)
Date: 2002-07-30 08:24

Message:
Logged In: YES 
user_id=176497

The default max cache size for entity beans is 100000, yes, 1 
million.  Try decreasing it, look in standardjboss.xml.  If 
decreasing doesn't work, then there is a memory leak either in 
JBoss or your application.  Let us know what you find.

<cache-policy-conf>       
   <min-capacity>50</min-capacity>       
   <max-capacity>1000000</max-capacity>       
</cache-policy-conf> 


----------------------------------------------------------------------

Comment By: Joe Simone (jsimone)
Date: 2002-07-30 07:36

Message:
Logged In: YES 
user_id=586242

By upping the max heap to 256 MB, the problem just 
happens later.  At pass 5753 (that's 57530 beans created (at 
10 per pass)).

I swapped out the DB from DB2 to Hypersonic and the out-of-
memory condition still occurs but sooner for some reason.  
Out-of-memory at 1261 passes with HS vs. 1451 passes with 
DB2.

joe

----------------------------------------------------------------------

Comment By: Bill Burke (patriot1burke)
Date: 2002-07-29 21:32

Message:
Logged In: YES 
user_id=176497

I hope this isn't a braindead answer, but have you tried 
increasing the heap size?  I think the default entity cache size is 
very large and you may be hitting the default heap maz of 64Meg.

-Xmx512M

is the java switch to increase heap.

----------------------------------------------------------------------

Comment By: Joe Simone (jsimone)
Date: 2002-07-29 19:10

Message:
Logged In: YES 
user_id=586242

Thanks for responding Luke, I appreciate it.

I am using IBM DB2 Enterprise Edition v. 7.2 with the latest 
fixpack 7 applied.  I am pretty sure you'll see the same thing 
with the freebee personal edition.

Anyway, I'll try and whittle down my application down to just 
the pertinent code for the failure and attach here.

I am really hammering the app server hard with long running 
tests from multiple clients - or at least trying to - and it hasn't 
been holding up for me.

Any help you can render is much appreciated.  I am willing to 
work with you to make sure this problem is fixed.

regards,
joe

----------------------------------------------------------------------

Comment By: Luke Taylor (luke_t)
Date: 2002-07-29 16:11

Message:
Logged In: YES 
user_id=369802

Do you have an example test app that you can post here which
reproduces the problem? The code you have here doesn't show
very much. Also the stack trace from the server log is
generally more useful.

Are you using the internal hypersonic database or an
external DB?
In any case, you won't see any SQL COMMIT commands in the log. 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=588241&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to