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

Enable to activate Grain after clearing its state #9165

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

scalalang2
Copy link

@scalalang2 scalalang2 commented Oct 8, 2024

resolve #9154

Background

The ClearStateAsync funcction doesn't remove the entry from storage by default.
Instead it only sets the state value to null,

If ReadStateAsync() is invoked when the value is null,
then it occurs an error from Serializer. Insufficient data present in buffer.

This error happens during the process of restarting our cluster.

  1. The default value of DeleteStateOnClear is false.
  2. The PubSubRendezvousGrain activates upon stream registration.
  3. It calls ClearStateAsync() if there are no producers.
  4. the grain reactivates after being deactivated, ReadStateAsync() is invoked
  5. This leads to an error -> Insufficient data present in buffer.
Microsoft Reviewers: Open in CodeFlow

options.GrainStorageSerializer = useJson
? new GrainStorageSerializer(jsonSerializer, binarySerializer)
: new GrainStorageSerializer(binarySerializer, jsonSerializer);
if (useFallback)
Copy link
Author

@scalalang2 scalalang2 Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue I reported is not found with this unit test.
because we've used a serializer has fallback (binary -> json and json -> binary).

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

Successfully merging this pull request may close these issues.

Cannot activate the grain after clearing its state.
1 participant