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

Fix session factory deserialization with Prevalence Cache #2196

Merged
merged 1 commit into from
Aug 21, 2019

Conversation

fredericDelaporte
Copy link
Member

Fix #2190

The Bamboo Prevalence cache does serialize entities to disk, with their keys, using binary serialization. NH 5.2 has included the session factory in the serialized data of keys.

This causes a crash when instantiating a session factory using a Prevalence cache having entities serialized, because their deserialization is triggered by the cache provider initialization, which occurs during session factory instantiation, before it registers its name for deserialization resolving. So it cannot deserialize keys due to them failing to deserialize their session factory.


SessionFactoryObjectFactory.AddInstance(uuid, name, this, properties);

#endregion
Copy link
Member Author

Choose a reason for hiding this comment

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

This fix, moving name/uuid registration at the beginning of the session factory construction, seems to work and does not cause any old test failure, but is quite debatable.

It allows deserialization to resolve a session factory not yet fully built. And this occurs in this Prevalence cache case, meaning it will recompute its cached entities keys hashcodes with a session factory not yet fully built.

This case is quite wicked. The persisters creation creates the caches, so we have to start their provider before creating the persisters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants