• 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: Exception in saveChanges(): rowDiffsForAttributes - snapshot does not contain value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exception in saveChanges(): rowDiffsForAttributes - snapshot does not contain value


  • Subject: Re: Exception in saveChanges(): rowDiffsForAttributes - snapshot does not contain value
  • From: Wolfram Stebel <email@hidden>
  • Date: Sat, 24 Feb 2007 14:20:52 +0100
  • Thread-topic: Exception in saveChanges(): rowDiffsForAttributes - snapshot does not contain value

Am 24.02.2007 4:08 Uhr schrieb "Chuck Hill" unter
<email@hidden>:

> As it turns out, I am an idiot.
Well, I can't disprove this :-)


>I was running and rerunning a set of
> functional tests.  I was not stopping the app, but between each run I
> would run a script to reset the data.  Sigh.  And part of the script,
Don't you use WOUnitTest? It helps setting up and tearing down tests very
well, as far as i recall...

> which I have been watching scroll before my eyes and not reading, was
> reseting the primary key generators in the database.  Which led EOF
> to generate primary keys for new objects that matched those of
> objects already in the snapshots.  Chaos ensued.  Considering what I
> was doing, I am amazed at the very small bad effect that it had.
>
> The offending bit of script moved, everything works as expected.
>
> Now, without a doubt, it is time for beer.
Well, thats always a good idea :-)
Go and meet some WO-Specialists :-)
Sacha et al :-)

>
> Chuck
Always enjoying your support

Wolfram
>
> On Feb 21, 2007, at 3:04 PM, Chuck Hill wrote:
>
>> Hi,
>>
>> Some of you will recognize this extremely fun exception:
>>
>> java.lang.IllegalStateException: rowDiffsForAttributes: snapshot in
>> com.webobjects.eoaccess.EODatabaseOperation {
>> _dbSnapshot = {};
>> ...
>> this = "<com.foo.bar.DownloadLog a849b0 _EOIntegralKeyGlobalID
>> [DownloadLog (java.lang.Long)0]>"; }";
>> _globalID = _EOIntegralKeyGlobalID[DownloadLog (java.lang.Long)0];
>> _databaseOperator = "EODatabaseUpdateOperator"; }
>> does not contain value for attribute named downloadDate with
>> snapshot key: downloadDate
>>
>> The stack trace is:
>> at
>> com.webobjects.eoaccess.EODatabaseOperation.rowDiffsForAttributes
>> (EODatabaseOperation.java:338)
>> at
>> com.webobjects.eoaccess.EODatabaseContext.createAdaptorOperationsForDa
>> tabaseOperationAttributes(EODatabaseContext.java:5373)
>> at
>> com.webobjects.eoaccess.EODatabaseContext.createAdaptorOperationsForDa
>> tabaseOperation(EODatabaseContext.java:5548)
>> at com.webobjects.eoaccess.EODatabaseContext.performChanges
>> (EODatabaseContext.java:6365)
>> at
>> com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditing
>> Context(EOObjectStoreCoordinator.java:415)
>> at com.webobjects.eocontrol.EOEditingContext.saveChanges
>> (EOEditingContext.java:3226)
>> at net.global_village.eofextensions.ForgetfulEC.saveChanges
>> (ForgetfulEC.java:54)
>> at net.global_village.eofvalidation.EOEditingContext.saveChanges
>> (EOEditingContext.java:126)
>> at
>> net.global_village.eofvalidation.NotifyingEditingContext.saveChanges
>> (NotifyingEditingContext.java:159)
>>
>>
>> The exception is correct, the snapshot _dbSnapshot = {}; does not
>> contain any values, let alone the one it is looking for.  I am not
>> completely sure of how this happens.  It is not consistent so I
>> believe it to be caused by concurrent threads sending EOF
>> notifications interacting with the locked / unlocked state of
>> editing contexts.
>>
>> The situation that I have that causes this exception is this: I
>> have a page that starts an import process.  It spins off a thread
>> that handles the actual import. This  thread has its own EC.  The
>> first thing it does is to create a new DownloadLog to record the
>> start / status of the import process.  While it is processing, it
>> periodically unlocks and re-locks the EC and does a refreshing
>> fetch on the download log so that it can see changes made in other
>> editing contexts.
>>
>> Once this thread is started, and concurrent with its processing,
>> the app goes to a page that monitors all the download logs.  This
>> was built using the AjaxGrid and refreshes every 30 seconds.  At
>> each refresh it does a refreshing fetch. Of course, its EC is
>> unlocked between requests.  It has a link to abort the import by
>> writing to the download log, though that is not being used when
>> this exception occurs.
>>
>> Periodically the download processing thread will throw the above
>> exception while saving an update to the download log.  My guess is
>> that the refreshing fetch is invalidating the snapshot that the EC
>> was referring to and it gets a null / empty dictionary for it as it
>> is still locked.
>>
>> I fixed this (or at least I can't reproduce it anymore) by doing
>> ec.unlock(); ec.lock(); immediately before ec.saveChanges();.  My
>> guess is that this allows the snapshot to get updated.  I suspect
>> there is still a race condition in there where the a refreshing
>> fetch is done on the download load while saveChanges() is in progress.
>>
>> Does anyone know anything more about this or can you shed light on
>> what is happening and how you worked around it?
>>
>>
>> Cheers,
>> Chuck
>>
>>
>>
>> --
>>
>> 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
>>
>>
>>
>>
>>

Dipl. Inform. Wolfram Stebel, bugs&errors
Flutgrabenstr. 19, 35576 Wetzlar
Tel. 06441/47633
Mailto:email@hidden
Web: www.bugs-and-errors.de


 _______________________________________________
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: Exception in saveChanges(): rowDiffsForAttributes - snapshot does not contain value
      • From: Chuck Hill <email@hidden>
References: 
 >Re: Exception in saveChanges(): rowDiffsForAttributes - snapshot does not contain value (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Exception in saveChanges(): rowDiffsForAttributes - snapshot does not contain value
  • Next by Date: Re: What is the trick to debug SQL?
  • Previous by thread: Re: Exception in saveChanges(): rowDiffsForAttributes - snapshot does not contain value
  • Next by thread: Re: Exception in saveChanges(): rowDiffsForAttributes - snapshot does not contain value
  • Index(es):
    • Date
    • Thread