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 Hyperion serializer config bug #7364

Merged
merged 2 commits into from
Oct 25, 2024

Conversation

Arkatufus
Copy link
Contributor

@Arkatufus Arkatufus commented Oct 25, 2024

The HyperionSerializer(ExtendedActorSystem) ctor method uses the wrong HOCON config.
HyperionSerializerConfig.Create() expects the config from the "akka.actor.serialization-settings.hyperion" path, but the HyperionSerializer ctor passes the HOCON root config to it.

Behavior change after this PR:
No known behavioral change.

Changes

  • Make sure the config being passed to the constructor is the correct config.

Copy link
Contributor Author

@Arkatufus Arkatufus left a comment

Choose a reason for hiding this comment

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

Self-review

# If true, hyperion serializer will preserve references between objects.
# This is necessary to support things such as cyclic dependencies between objects.
preserve-object-references = true
serializers {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nothing is changed on the default config file, all changes were white space changes from tab to spaces to make sure that text formatting is consistent

@@ -170,7 +170,8 @@ public sealed class HyperionSerializerSettings
/// <summary>
/// Default settings used by <see cref="HyperionSerializer"/> when no config has been specified.
/// </summary>
public static readonly HyperionSerializerSettings Default = Create(HyperionSerializer.DefaultConfiguration());
public static readonly HyperionSerializerSettings Default = Create(HyperionSerializer.DefaultConfiguration()
.GetConfig("akka.actor.serialization-settings.hyperion"));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the actual config HyperionSerializerSettings was expecting, not the root config.

@Aaronontheweb Aaronontheweb added this to the 1.5.31 milestone Oct 25, 2024
@Aaronontheweb
Copy link
Member

No known behavioral change.

doesn't this mean that the defaults behaviors, if different than what the HOCON specifies, are now enforced?

@Arkatufus
Copy link
Contributor Author

Luckily, all of the default values are exactly the same to what we've assigned if the config were empty.

return new HyperionSerializerSettings(
preserveObjectReferences: config.GetBoolean("preserve-object-references", true),
versionTolerance: config.GetBoolean("version-tolerance", true),
knownTypesProvider: type,
packageNameOverrides: packageNameOverrides,
surrogates: surrogates,
disallowUnsafeType: config.GetBoolean("disallow-unsafe-type", true),
typeFilter: typeFilter);

knownTypesProvider = knownTypesProvider ?? typeof(NoKnownTypes);

So this PR have no behavior impact, unless we change the default values.

@Arkatufus
Copy link
Contributor Author

No known behavioral change.

doesn't this mean that the defaults behaviors, if different than what the HOCON specifies, are now enforced?

Yes and no, yes if the default were different, luckily it is not.

@Aaronontheweb
Copy link
Member

That's good to know - thanks @Arkatufus

@Aaronontheweb Aaronontheweb merged commit 7685a6f into akkadotnet:dev Oct 25, 2024
12 checks passed
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