I did turn on database logging.  What I saw was that the app selected the
next value from a sequence, then paused for 20 seconds, then did an insert
(and then did 20 other sql statements within a second).  It does the same
exact thing each time.

Also, the java process is using over 100% cpu, not the database...hence they
mystery :(

On Thu, Jul 8, 2010 at 10:02 AM, John Huss <[email protected]> wrote:

> Did you turn on SQL logging?  Is it executing queries in that time?
>  Probably the database is the bottleneck.
>
> John
>
> On Thu, Jul 8, 2010 at 8:46 AM, Greg Lappen <[email protected]> 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/johnthuss%40gmail.com
>>
>> This email sent to [email protected]
>>
>
>
 _______________________________________________
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