db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Joseph <gai...@yha.att.ne.jp>
Subject Re: recursive save
Date Wed, 15 Jan 2003 07:06:37 GMT

I seem to be experiencing something that seems like a recursive save. 
 At least I am getting java.lang.OutOfMemory errors when I am trying to 
perform a save() operation.  

The odd thing is that it doesn't seem to happen when I run an 
independent test, but only when I am running the code from within 
Tomcat.  Well, I think in the independent mode the JVM just terminates 
itself (it's running within ant).  Whereas in the Tomcat environment, 
the JVM doesn't crash out, but the memory consumption spirals up and up 
until I get OutOfMemoryErrors.

Under these circumstances a recursive bit of code would fit the bill as 
culprit, however looking at  my OM classes I see that after the save() 
operation in called in my Event object that extends BaseEvent the 
following functions are called:

[Event] save()
[BaseEvent] save(String dbName)
[BaseEvent] save(DBConnection dbCon)
[BaseEventPeer] doInsert( Criteria criteria, DBConnection dbCon )
[BasePeer] doInsert( Criteria criteria, DBConnection dbCon )

It is after calling BasePeer.doInsert() that the code hangs - and I get 
OutOfMemory errors in a Tomcat environment, and the JVM terminates in 
the ant test environment.

I haven't placed debug statements with the BasePeer code yet, as that 
will require re-compiling the jar etc., but superficially there does not 
seem to be any recursion taking place in the OM classes, although 
conceivably my bugging operations are not telling the whole story.

I have read the emails regarding the recursive saving problem, and been 
looking at the latest code in Torque CVS but I can't fathom what is 
actually causing the recursive problem being talked about, and whether 
it might be the same problem I am experiencing.

Could anyone explain to me what the existing recursive save problem was? 
 Or rather which are the methods that are called recursively and what 
triggers them to be called so, a flag or something?

Thanks in advance.


Byron Foster wrote:

> Would anyone consider making this a switch in the properties file? 
> Maybe the switch would turn on recursive saves for getters and 
> setters, and disallow people to overide the save(Connection con) method.
> Byron
> Stephen Haberman wrote:
>> We've hit a point where it'd be really nice to have the recursive save
>> stuff that was commented out with:
>> #* FIXME! the following code can cause an infinite loop, needs more
>> thought
>> shows the infinite loop: System.out.println("Entering save for " +
>> this);
>>     #if ($pVars.size() != 0)
>> Could I re-add this with cycle checking? E.g. something like:
>> private save(Connection conn, HashSet alreadySaved)
>> {
>>   if (!alreadySaved.contains(this))
>>   {
>>     ...
>>    }
>> }
> -- 
> To unsubscribe, e-mail:   
> <mailto:turbine-torque-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:turbine-torque-dev-help@jakarta.apache.org>

View raw message