Skip to content
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

GetOrAddAsync of IReliableDictionary throwing when already exists. #896

Closed
zeodamian opened this issue Aug 22, 2017 · 5 comments
Closed
Assignees

Comments

@zeodamian
Copy link

This usually doesn't happen, but suddenly did, repeatedly. I thought it was supposed to just get it if it already existed? (thus GetOrAdd).
What is this error caused by, and how can I avoid it?

State provider urn:FooBar/dataStore already exists at Microsoft.ServiceFabric.Replicator.DynamicStateManager.<AddSingleStateProviderAsync>d__166.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.ServiceFabric.Replicator.DynamicStateManager.<GetOrAddStateProviderAsync>d__1021.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.ServiceFabric.Data.ReliableStateManagerImpl.d__191.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n

@masnider
Copy link
Member

@zeodamian - can you share the code snippet where you actually saw this?

@zeodamian
Copy link
Author

This is where it was throwing:

 async Task<bool> Init<T>()
        {
            var stateKey = typeof(T).Name;
            IReliableDictionary<Guid, T> dataStore;
            IReliableDictionary<Guid, T> seedStore;
            using (var tx = _stateManager.CreateTransaction())
            {
                dataStore = await _stateManager.GetOrAddAsync<IReliableDictionary<Guid, T>>(tx, stateKey);
                seedStore = await _stateManager.GetOrAddAsync<IReliableDictionary<Guid, T>>(tx, $"{stateKey}_Seed");
                await tx.CommitAsync();
            }

    // more code..
}

which was run with a retry logic. no other transactions in outer scopes.

@mcoskun
Copy link

mcoskun commented Oct 26, 2017

@zeodamian, if you're still having issues with this, go ahead and open an Azure support ticket for this so we can get a closer look. More info on that here: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-support.

It would be helpful if you could include the partition id, replica id and transaction id and time range for incident.

@mcoskun
Copy link

mcoskun commented Oct 28, 2017

@zeodamian , one issue that can cause this is found. It will be fixed in a future release (I'll update the thread). If you can follow the above steps to send your traces, I can verify that you are hitting the same issue. Thank you for reporting this issue.

@masnider masnider self-assigned this Oct 23, 2019
@gkhanna79 gkhanna79 transferred this issue from microsoft/service-fabric-issues Apr 29, 2020
@zuhairp
Copy link
Member

zuhairp commented Aug 14, 2020

Closing due to inactivity

@zuhairp zuhairp closed this as completed Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants