Can you tell us why we are getting InstanceVersionChangedException errors ("Instance version changed or it was removed from the database").

For example:

2010-09-15 08:31:54,122 [ERROR] (null) - There was an error when confirming organization registration 16550368
DataObjects.NET.Exceptions.InstanceVersionChangedException: Instance version changed or it was removed from the database.
   at DataObjects.NET.Session.InnerPersistObjects(Key[] keys, Boolean withExternalFields)
   at DataObjects.NET.Session.Persist()
   at DataObjects.NET.QueryBase.InternalExecute(Boolean count)
   at DataObjects.NET.QueryBase.InnerExecute(Int64 top, QueryOptions options)
   at DataObjects.NET.QueryBase.Execute(Int64 top, QueryOptions options)
   at DataObjects.NET.Query.Execute(Int64 top, QueryOptions options)
   at DataObjects.NET.QueryBase.Execute[T](Int64 top, QueryOptions options)
   at DataObjects.NET.QueryBase.Execute[T]()
   at AGO.ObjectFactoryImpl.FindOrCreateThisAddress(Session session, String Address1, String Address2, String City, State State, String Zip, County County, String Address3, String Address4, Country Country, Boolean WasScrubbedInternally, Boolean WasScrubbedExternally) in C:\Projects\EnterpriseDataService\EnterpriseData Service\Libraries\AGO Server Library\ObjectFactory.cs:line 286
   at AGO.ObjectServiceImpl.FindOrCreateAddress(String Address1, String Address2, String City, State State, String Zip, County County, String Address3, String Address4, Country Country, Boolean WasScrubbedExternally, Boolean TryToScrubFirst) in C:\Projects\EnterpriseDataService\EnterpriseData Service\Libraries\AGO Server Library\Services\ObjectService.cs:line 640
   at AGO.ObjectServiceImpl_DataObjectsDotNetProxy.FindOrCreateAddress(String _Address1, String _Address2, String _City, State _State, String _Zip, County _County, String _Address3, String _Address4, Country _Country, Boolean _WasScrubbedExternally, Boolean _TryToScrubFirst) in c:\Projects\EnterpriseDataService\EnterpriseData Service\Hosts\EnterpriseData Console Host\bin\Debug\ProxyAssembly.cs:line 88000
   at AGO.Charitable.CharitableOrganizationRegistrationInfoImpl.ConfirmRegistration(UserInfo user, Boolean validated) in C:\Projects\EnterpriseDataService\EnterpriseData Service\Libraries\AGO Server Library\Charitable\CharitableOrganizationRegistrationInfo.cs:line 145
2010-09-15 08:31:54,122 [ERROR] (null) - Failed to confirm an account registration!
DataObjects.NET.Exceptions.InstanceVersionChangedException: Instance version changed or it was removed from the database.
   at DataObjects.NET.Session.InnerPersistObjects(Key[] keys, Boolean withExternalFields)
   at DataObjects.NET.Session.Persist()
   at DataObjects.NET.QueryBase.InternalExecute(Boolean count)
   at DataObjects.NET.QueryBase.InnerExecute(Int64 top, QueryOptions options)
   at DataObjects.NET.QueryBase.Execute(Int64 top, QueryOptions options)
   at DataObjects.NET.Query.Execute(Int64 top, QueryOptions options)
   at DataObjects.NET.QueryBase.Execute[T](Int64 top, QueryOptions options)
   at DataObjects.NET.QueryBase.Execute[T]()
   at AGO.ObjectFactoryImpl.FindOrCreateThisAddress(Session session, String Address1, String Address2, String City, State State, String Zip, County County, String Address3, String Address4, Country Country, Boolean WasScrubbedInternally, Boolean WasScrubbedExternally) in C:\Projects\EnterpriseDataService\EnterpriseData Service\Libraries\AGO Server Library\ObjectFactory.cs:line 286
   at AGO.ObjectServiceImpl.FindOrCreateAddress(String Address1, String Address2, String City, State State, String Zip, County County, String Address3, String Address4, Country Country, Boolean WasScrubbedExternally, Boolean TryToScrubFirst) in C:\Projects\EnterpriseDataService\EnterpriseData Service\Libraries\AGO Server Library\Services\ObjectService.cs:line 640
   at AGO.ObjectServiceImpl_DataObjectsDotNetProxy.FindOrCreateAddress(String _Address1, String _Address2, String _City, State _State, String _Zip, County _County, String _Address3, String _Address4, Country _Country, Boolean _WasScrubbedExternally, Boolean _TryToScrubFirst) in c:\Projects\EnterpriseDataService\EnterpriseData Service\Hosts\EnterpriseData Console Host\bin\Debug\ProxyAssembly.cs:line 88000
   at AGO.Charitable.CharitableOrganizationRegistrationInfoImpl.ConfirmRegistration(UserInfo user, Boolean validated) in C:\Projects\EnterpriseDataService\EnterpriseData Service\Libraries\AGO Server Library\Charitable\CharitableOrganizationRegistrationInfo.cs:line 187
   at AGO.Charitable.CharitableOrganizationRegistrationInfoImpl.ConfirmRegistration(Boolean validated) in C:\Projects\EnterpriseDataService\EnterpriseData Service\Libraries\AGO Server Library\Charitable\CharitableOrganizationRegistrationInfo.cs:line 78
   at AGO.Charitable.CharitableOrganizationRegistrationInfoImpl.ConfirmRegistration() in C:\Projects\EnterpriseDataService\EnterpriseData Service\Libraries\AGO Server Library\Charitable\CharitableOrganizationRegistrationInfo.cs:line 58
   at AGO.Charitable.CharitableOrganizationRegistrationInfoImpl_DataObjectsDotNetProxy.ConfirmRegistration() in c:\Projects\EnterpriseDataService\EnterpriseData Service\Hosts\EnterpriseData Console Host\bin\Debug\ProxyAssembly.cs:line 242025
   at AGO.Charitable.CharitableUserRegistrationInfoImpl.ConfirmAccountRegistration() in C:\Projects\EnterpriseDataService\EnterpriseData Service\Libraries\AGO Server Library\Charitable\CharitableUserRegistrationInfo.cs:line 152

asked Sep 15 '10 at 15:54

dku's gravatar image

dku
6333

edited Sep 17 '10 at 01:11

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

Hello, I remember there was a comment by you, but now it disappeared. Is this intentional / occasional, or am I mistaken?

(Sep 23 '10 at 02:36) Alex Yakunin Alex%20Yakunin's gravatar image

One Answer:

Most probably this error is a result of concurrent modifications of a same DataObject instance from several transactions.

Lets imagine some DataObject instance that have, for example, "Counter" field which value must be increased by 1 each time user performs some specific action. In the case such action executed concurrently the call which is completing first will be successful but the second one will fail. Failure in conditions such as in our example is absolutely correct because both transactions had read the same initial counter value, both increased it by 1, and obviously the first attempt to save new value is correct but second is wrong because it attempts to save wrong data.

answered Sep 16 '10 at 02:18

Alex%20Ustinov's gravatar image

Alex Ustinov
2484

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA