• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: 20 Second Delay on editingContext.saveChanges()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20 Second Delay on editingContext.saveChanges()


  • Subject: Re: 20 Second Delay on editingContext.saveChanges()
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 8 Jul 2010 07:58:29 -0700

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@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

--
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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: 20 Second Delay on editingContext.saveChanges()
      • From: Mark Ritchie <email@hidden>
    • Re: 20 Second Delay on editingContext.saveChanges()
      • From: Mike Schrag <email@hidden>
References: 
 >20 Second Delay on editingContext.saveChanges() (From: Greg Lappen <email@hidden>)

  • Prev by Date: Re: 20 Second Delay on editingContext.saveChanges()
  • Next by Date: FileUpload problem in AjaxModalDialog
  • Previous by thread: Re: 20 Second Delay on editingContext.saveChanges()
  • Next by thread: Re: 20 Second Delay on editingContext.saveChanges()
  • Index(es):
    • Date
    • Thread