Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
This is one of those unreproducable occasional error in the log questions. Hoping maybe someone has encountered it.
We are setting a custom member property and then saving that member. Every so often we see an exception updating the index. Interestingly it's not always the same value in the property type id (the 3rd value in the index). I assume saving the member saves all properties though.
var member = _memberService.GetByEmail(model.LoginEmail);
ERROR Umbraco.Core.Persistence.UmbracoDatabase - Exception (3afecff6).
System.Data.SqlClient.SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo.cmsPropertyData' with unique index 'IX_cmsPropertyData_1'. The duplicate key value is (271867, 9b728635-eae4-4616-8b48-c34bd0838c77, 412).
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
at Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco)
Has anyone else seen this?
Umbraco Version: 7.10.4
When I have two different member types in Member section, both with same custom property alias (of type textbox), I get that error when trying to insert value and save it using MemberService in a controller.
Umbraco version 7.12.4
There is a duplicate value being generated / inserted in DB for unique field
I don't suppose this turned out to be related to events running when saving members? Seeing something similar and mulling over raiseEvents = false.
Similar issue here. Hard to understand why the issue is occurring. Dave's hint is interesting but changing the raise events made no difference in the outcome. But it is conceivable that a Login would perform an update and a Save would be coming on the heals of that. So order of calls would seem very important.
For example: Member logs in and profile data is updated along side it.
var member = MemberService.GetByUsername(...); //Get current version of member
Member.Login(...);//Login - *Updates version due to change in last login date
member.SetValue(alias, value); //updates old version due to order of calls.
MemberService.Save(member); //creates collision because the login activity was called after the member retrieval thus making a save on an old version.
This order of calls would create the error.
GetByUsername Should be called AFTER Login to avoid updating an out of date version of member.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted