-
Notifications
You must be signed in to change notification settings - Fork 272
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
Durable entity with null state persistence #1418
Comments
This has been discussed in the past in this issue. I believe the conclusion reached in that issue was that you should use the PurgeInstanceHistoryAsync() API to remove these from the table storage that the In general, this is something that we should probably document better, or at least make more discoverable. @cgillum, @anthonychu, @sebastianburckhardt thoughts? |
Yeah, the |
@emreertugrul to clarify, if you use IDurableClient (which is the union of the IDurableOrchestrationClient and the IDurableEntityClient), you can use that method. The entity's "orchestration instance id" is Perhaps IDurableEntityClient deserves a method like |
I think there are several issues here.
|
Were are we with this? I'm currently in a situation where I have an entity which I tried to remove using The output from
And the output from
The problem is that it's no longer possible to use the entity. When my orchestration tries to read from the entity, it just stops with the log message Here is the relevant code from the orchestration function which tries to load (the terminated) entity:
The log shows this:
I guess is that the orchestration never gets a "reply" from the entity so the orchestration is forever stuck in "running" state waiting for a reply? The only way around this is manually terminate the orchestration and create a new entity with a different name. So:
I'm running this locally in Azurite by the way, if that makes any difference. |
Sorry for the confusion we have caused. I think we need to improve the docs and fix some remaining bugs to prevent this in the future. The correct and safe way to delete an entity is to call
TerminateAsync should never be called on an entity, as it will permanently disable this entity as you have observed. Terminating an entity does not make sense because it terminates the orchestration that functions as the entity scheduler, which then means the entity becomes forever unresponsive. To remove an entity that has gotten into a bad state (e.g. after TerminateAsync) you can call PurgeAsync which should remove all traces of the entity from storage. Under normal circumstances this is not necessary. |
Hi,
I've created a durable entity function that does some action, and when a certain condition is met it deletes itself with
Entity.Current.DeleteState()
When this is done the state is cleared (becomes null) but the entity still persists and is sent within the results when ListEntitiesAsync is called:
var allRunningEntities = await client.ListEntitiesAsync(new EntityQuery { EntityName = nameof(PlayingMatchEntity), FetchState = true, }, new System.Threading.CancellationToken());
Result:
I cant find in any documentation on how to get rid of these null-state entities..
The text was updated successfully, but these errors were encountered: