Hi Greg,

Is the database content (not the schema) the same for both deployments?  Could 
one have a very large number of back-pointing relationships that the other does 
not have?  If so, I will suggest that you have a modelling issue.  If not... 
puzzling.

Chuck


On Jul 8, 2010, at 6:46 AM, Greg Lappen wrote:

>  Hi all,
> 
> I am running into a bizarre issue with our WebObjects Application.  I have 
> searched the lists for quite a while, but could not find a case where someone 
> had the same problem.
> 
> What is even stranger is that our application is deployed on two different 
> servers, both with WebObjects 5.4.3 and in one environment the issue occurs, 
> and not in the other.  
> 
> What I see is that calling editingContext.saveChanges() is returning 
> immediately in one case, and hanging for 20 seconds in the other case.  It's 
> not really "hanging" - the CPU is pegged at over 100%, and taking thread 
> dumps during that 20 seconds shows something like this:
> 
> "WorkerThread3" prio=5 tid=0x000000010296a800 nid=0x1519b2000 runnable 
> [0x00000001519af000]
>    java.lang.Thread.State: RUNNABLE
>       at java.lang.reflect.Array.newInstance(Array.java:52)
>       at 
> com.webobjects.foundation._NSCollectionPrimitives.copyArray(_NSCollectionPrimitives.java:123)
>       at com.webobjects.foundation.NSArray.objectsNoCopy(NSArray.java:356)
>       at 
> com.webobjects.foundation.NSMutableArray._removeObject(NSMutableArray.java:225)
>       at 
> com.webobjects.foundation.NSMutableArray.removeObject(NSMutableArray.java:247)
>       at 
> com.webobjects.foundation.NSMutableArray.removeObjects(NSMutableArray.java:399)
>       at 
> com.webobjects.foundation.NSMutableArray.removeObjectsInArray(NSMutableArray.java:285)
>       at 
> com.webobjects.foundation._NSArrayUtilities.arrayExcludingObjectsFromArray(_NSArrayUtilities.java:173)
>       at 
> com.webobjects.eoaccess.EODatabaseContext.recordChangesInEditingContext(EODatabaseContext.java:5943)
>       at 
> com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:373)
>       at 
> com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3192)
>       at net.paperfree.lightbeam.model.LPFile.setFileData(LPFile.java:102)
> 
> Seems like the EODatabaseContext is doing some housekeeping before executing 
> the SQL....here's the Java code in question:
> 
> public class LPFile extends _LPFile {
>     ....
>     ....
>     public synchronized void setFileData(NSData fileData) throws IOException {
>       // Update forms by deleting existing ones, then adding new ones
>         for (int i=lpFileForms().count()-1; i>=0; i--) {
>             final LPFileForm lpFileForm = (LPFileForm) 
> lpFileForms().objectAtIndex(i);
>             this.removeFromLpFileForms(lpFileForm);
>             editingContext().deleteObject(lpFileForm);
>         }
> 
>         // Get new form list via SOAP call
>         Element docInfoElm = LPServer.threadLocal().exportDocumentInfo(this); 
>       
>         List formElms = formsElm.getChildren("form");
>         for (int i = 0; i < formElms.size(); i++) {
>             Element formElm = (Element) formElms.get(i);
>             LPFileForm lpFileForm = new LPFileForm();
>           
>           // extract data from xml, put into lpFileForm
> 
>           // Setup relationships to lpForm and lpFile
>           lpFileForm.setLpForm(lpForm);
>             lpFileForm.setLpFormID(lpForm.id());
>             lpFileForm.setLpFile(this);
>             lpFileForm.setLpFileID(this.fileID());    
> 
>           this.addToLpFileForms(lpFileForm);
>             editingContext().insertObject(lpFileForm);
>       }
> 
>       editingContext().saveChanges();
>     }
>     ....
>     ....
> }
> 
> Does the above code have anything obviously wrong with it?  It's basically 
> clearing a one-to-many relationship, then re-populating it.  I call 
> this.addToLpFileForms() because I want the relationship updated in memory as 
> well as in the database.
> 
> Any insight would be hugely appreciated.
> 
> Thanks,
> 
> Greg
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
> 
> This email sent to [email protected]

-- 
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.    
http://www.global-village.net/products/practical_webobjects







Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to