Cannot insert duplicate key row
Anyone else getting this? Two attempted upgrades, both hit this same error...
I update with the project manager, download the new .lic file (overwrite it), rebuild and then load up the site. Fails every time it seems.
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
|
[SQLException: Cannot insert duplicate key row in object 'sitefinitysteve.sf_schema_vrsns' with unique index 'idx_sf_schema_vrsns'. The statement has been terminated.] Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute() +919 OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute() +119 OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes) +2477 [DuplicateKeyException: Insert of '255938952-70e26627-cf18-4033-95e5-61a9ab8c8bf6' failed: Telerik.OpenAccess.RT.sql.SQLException: Cannot insert duplicate key row in object 'sitefinitysteve.sf_schema_vrsns' with unique index 'idx_sf_schema_vrsns'. The statement has been terminated. at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute() at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute() at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes) INSERT INTO [sf_schema_vrsns] ([id], [app_name], [assembly], [connection_id], [cultures], [last_upgrade_date], [meta_data_changed], [module_name], [previous_version_number], [version_number]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (set event logging to all to see parameter values)] DynamicModule.ns.Wrapped_OpenAccessMetaDataProvider_68c0e8931b5242e1b7a928cf04ee1d3f.Initialize(String providerName, NameValueCollection config, Type managerType) +405 Telerik.Sitefinity.Data.ManagerBase`1.InstantiateProvider(IDataProviderSettings providerSettings, Type providerType, ExceptionPolicyName policy, ManagerBase`1 manager) +2211 Telerik.Sitefinity.Data.ManagerBase`1.InstantiateProvider(IDataProviderSettings providerSettings, ExceptionPolicyName policy, ManagerBase`1 manager) +74 Telerik.Sitefinity.Data.ManagerBase`1.SetProvider(String providerName, String transactionName) +214 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +117 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +247 System.Activator.CreateInstance() +88 Telerik.Sitefinity.Data.ManagerBase`1.GetManager(String providerName, String transactionName) +115 Telerik.Sitefinity.Services.SystemManager.Initialize() +142 Telerik.Sitefinity.Abstractions.Bootstrapper.RegisterRoutes(RouteCollection routes) +243 Telerik.Sitefinity.Abstractions.Bootstrapper.Bootstrap() +338 Telerik.Sitefinity.Web.SitefinityHttpModule.Init(HttpApplication context) +30 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +546 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375 [HttpException (0x80004005): Exception has been thrown by the target of an invocation.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11529072 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4784373 |
Seems like it keeps trying to insert records into here: sf_schema_vrsns
Heres a trace
http://dl.dropbox.com/u/3234184/trace.zip
I had the same issue, save my error referenced "dbo" instead of "sitefinitysteve." What resolved it for me was removing the projectName attribute and its value from the ProjectConfig.config.
Did you do something after that by any chance?
Didnt seem to work here
Sorry, I don't remember having to do anything else. Although, we haven't gone live with the site yet, so I had the liberty of restarting with a fresh database and new set of config files. I wouldn't go crazy on my opinion as someone who's just recently started developing for 4.0, but I'd guess there's something else in one of your config files that's causing problems.
Hi Jeff,
I opened the trace and I see which statement fails. There is a UNIQUE index on 3 fields in the sf_schema_vrsns table - app_name, module_name and connection_id. You could send us your project so we could investigate the issue more thoroughly, but meanwhile I could suggest you do the following - after the upgrade take note of the row that has
app_name = NULL and module_name = 'Sitefinity' (it should be only one)
temporary drop the index and load this site - this should add a second row with similar parameters, then delete the first row. I'm not sure this will work but it seems our upgrade scripts execute an INSERT instead of UPDATE statement when updating this particular row in the database, which causes the constraint error.
@Lubomir
Is this something that will be fixed for 4.1 SP1? If that's the case I cant wait on updating this site...knowing that you guys are going to fix the issue (I say going assuming it wont miss SP1 due to other priorities ;)
It's shared hosting and the DB is marked annoyingly against a schema, and they're using an older DB version than I am so I cant edit everything here and just give them the DB to re-attach.
I got this issue when upgrading from 4.0, my way of solving this was simply to open up the administrator area (xxx.xx/sitefinity) and logging in, it gave me a screen of where I had to re-validate my license, I entered my information and voilah, then I simply logged in with my account and I got in. After doing this I did not get any SQL error on the actual site, so yeah thats how it worked for me :)
Yeah sadly I can't even GET to the admin area...
Hello Steve,
We tracked down the problem and it was solved. It will be available for the upcoming Service Release.
Best wishes,
Lubomir Velkov
the Telerik team
@Lubomir
Sadly I can assure you it did not make its way into the latest internal release as I still get this error (now on a new project)
Can you tell me the fix please?
I wiped the row out of "sf_schema_vrsns", now it's endlessly inserting rows with version 0\0
Hello Steve,
I apologize for any misunderstanding that might have happened - I mean the SP release due by the end of the next week. You were checking the internal build release where this fix was not checked in.
All the best,