-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EF key lookup bugs #1194
Comments
https://pastebin.com/Tz8a3qyX (this is with log in with fartwhif, use any of the gems in the main backpack, do /save-now, and it happens |
More simple instructions to duplicate: /ci 9425 |
Partially fixed wiht #1203 |
XP lever bug: Testing with this PR: #1213 /die 2019-01-03 17:00:42,943 ERROR: SaveBiota failed with exception: Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions. |
This latest bug (expected to affect 1 row, but instead 0) seems to be fixed in #1213 @LtRipley36706 discovered the key insight, none of the data in a composite key column can be 0 Since vitae is the only spell that uses layer id 0, this is why we have only been seeing it with the vitae spell The fix was to use layer id 1 for vitae internally in the db. Just to make sure everything matches up with retail exactly, when the vitae enchantment is sent across the network, it still sends layer 0 there |
Bug Report or Feature Request (mark with an
x
)Repro steps.
create a new char, /addallspells, log out
The log given by the failure.
2018-12-29 14:26:18,371 ERROR: SaveBiota failed with exception: System.InvalidOperationException: The instance of entity type 'BiotaPropertiesSpellBook' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked. When attaching existing entities, ensure that only one entity instance with a given key value is attached. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values.
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IdentityMap
1.ThrowIdentityConflict(InternalEntityEntry entry) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IdentityMap
1.Add(TKey key, InternalEntityEntry entry, Boolean updateDuplicate)at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTracking(InternalEntityEntry entry)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState(EntityState oldState, EntityState newState, Boolean acceptChanges)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.PaintAction(EntityEntryGraphNode node, Boolean force)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph[TState](EntityEntryGraphNode node, TState state, Func
3 handleNode) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.NavigationFixer.NavigationCollectionChanged(InternalEntityEntry entry, INavigation navigation, IEnumerable
1 added, IEnumerable1 removed) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntryNotifier.NavigationCollectionChanged(InternalEntityEntry entry, INavigation navigation, IEnumerable
1 added, IEnumerable`1 removed)at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.DetectNavigationChange(InternalEntityEntry entry, INavigation navigation)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.DetectChanges(InternalEntityEntry entry)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.DetectChanges(IStateManager stateManager)
at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
at ACE.Database.ShardDatabase.SaveBiota(Biota biota, ReaderWriterLockSlim rwLock) in C:\dev\gmriggs\ACE\Source\ACE.Database\ShardDatabase.cs:line 225
Here is also a similar error reported by fartwhif, possibly related:
SaveBiota failed with exception: EFC.DbUpdateException: An error occurred while updating the entries. See inner ---> MySql.Data.MySqlClient.MySqlException: Duplicate entry '1342177281-629-1' for key 'wcid_enchantmentregistry_objectId_spellId_layerId_uidx' ---> MySql.Data.MySqlClient.MySqlException: Duplicate entry '1342177281-629-1' for key 'wcid_enchantmentregistry_objectId_spellId_layerId_uidx'
at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in src\MySqlConnector\Core\ResultSet.cs:line 44
--- End of inner ---
at MySql.Data.MySqlClient.MySqlDataReader.ActivateResultSet(ResultSet resultSet) in src\sqlcl\MySqlDataReader.cs:line 93
at MySql.Data.MySqlClient.MySqlDataReader.NextResultAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in src\sqlcl\MySqlDataReader.cs:line 62
at MySql.Data.MySqlClient.MySqlDataReader.NextResult() in src\sqlcl\MySqlDataReader.cs:line 26
at EFC.Update.AffectedCountModificationCommandBatch.Consume(RelationalDataReader reader)
--- End of inner ---
at EFC.Update.AffectedCountModificationCommandBatch.Consume(RelationalDataReader reader)
at EFC.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
at EFC.Update.Internal.BatchExecutor.Execute(DbContext _, ValueTuple
2 parameters) at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlExecutionStrategy.Execute[TState,TResult](TState state, Func
3 operation, Func3 verifySucceeded) at EFC.Update.Internal.BatchExecutor.Execute(IEnumerable
1 commandBatches, IRelationalConnection connection)at EFC.ChangeTracking.Internal.StateManager.SaveChanges(IReadOnlyList`1 entriesToSave)
at EFC.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
at EFC.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
at ACE.Database.ShardDatabase.SaveBiota(Biota biota, ReaderWriterLockSlim rwLock)
Desired functionality.
not crash
Mention any other details that might be useful.
The text was updated successfully, but these errors were encountered: