openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C N Davies" <...@cndavies.com>
Subject RE: Stack overflow issue
Date Tue, 29 Sep 2009 15:07:16 GMT
Not a dumb idea, in fact that is what  I thought but it made things worse!

 

When I deal with a smaller number of records being saved the issue goes
away. But as per my email below, it looks like I just needed to null the
Entity once I had saved it and that solved my issue. Not sure why, maybe a
garbage collection issue.

 

Very puzzling J 

 

Chris

 

 

From: Wes Wannemacher [mailto:wesw@wantii.com] 
Sent: Tuesday, 29 September 2009 11:50 PM
To: users@openjpa.apache.org; cnd@cndavies.com
Subject: Re: Stack overflow issue

 

I'm somewhat of a n00b, so take my advice with a grain of salt, but maybe
you just need to flush periodically, i.e. - 

 

For (int i=0; i<2000; i++){

Myentity myEnt = <call function to create entity>

em.save(myEnt);

if (i % 25 == 0 )

    em.flush();

}

em.flush();

 

 

-Wes

 

On Tue, Sep 29, 2009 at 6:38 AM, C N Davies <cnd@cndavies.com> wrote:

I found that this piece of code:

 

For (int i=0; i<2000; i++){

Myentity myEnt = <call function to create entity>

em.save(myEnt);

}

 

Caused the issue. A simple change to this:

 

Myentity myEnt = null;

 

For (int i=0; i<2000; i++){

myEnt = <call function to create entity>

em.save(myEnt);

myEnt = null;

}

 

Fixes the issue. I guess the entities were not being cleaned up causing the
stack to overflow somewhere in the OpenJPA engine.

 

Strange but true!

 

Chris

 

 

 

From: C N Davies [mailto:cnd@cndavies.com] 
Sent: Tuesday, 29 September 2009 4:07 PM
To: 'users@openjpa.apache.org'
Subject: Stack overflow issue

 

Hi, 

 

My software is loading some data and as a result creates about 2000 db
records. The transaction commits just fine, and the function returns ok, a
few seconds later I get a stack overflow error as below.

 

Everything seems to work fine, all the records make it to the database, but
I can't see why the stack overflow is being thrown. I increased the stack
size to 1024 but get the same result. I can even close the entity manager
fine but again I get the stack overflow issue.

 

Does anyone have any ideas as to what the issue is?

 

Thanks 

 

Chris

 

OpenJPA 1.2.1

 

Exception in thread "Thread-8" java.lang.StackOverflowError

      at java.security.AccessController.doPrivileged(Native Method)

      at
org.apache.openjpa.enhance.Reflection.getDeclaredField(Reflection.java:201)

      at
org.apache.openjpa.enhance.Reflection.findField(Reflection.java:180)

      at
org.apache.openjpa.enhance.com$trm$loadtypes$McQEquitrac$pcsubclass.pcProvid
eField(Unknown Source)

      at
org.apache.openjpa.kernel.StateManagerImpl.provideField(StateManagerImpl.jav
a:3013)

      at
org.apache.openjpa.kernel.SaveFieldManager.isFieldEqual(SaveFieldManager.jav
a:189)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
827)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

      at
org.apache.openjpa.kernel.ManagedCache.dirtyCheck(ManagedCache.java:307)

      at
org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(BrokerImpl.java
:3796)

      at org.apache.openjpa.kernel.BrokerImpl.setDirty(BrokerImpl.java:3913)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1601)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1515)

      at
org.apache.openjpa.kernel.StateManagerImpl.dirtyCheck(StateManagerImpl.java:
828)

 

 

--
Neil Davies
Chief Technology Officer

 

Mobile:                +61 403 655 872
Email:                  neil.davies@spendware.com
Web:                      <http://www.spendware.com/> www.spendware.com

 

Error! Filename not specified.

 




-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat... 
Ask me for a quote!


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message