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

Issue with latest Hyperion release with Akka 1.3 #2976

Closed
mithril52 opened this issue Aug 12, 2017 · 50 comments
Closed

Issue with latest Hyperion release with Akka 1.3 #2976

mithril52 opened this issue Aug 12, 2017 · 50 comments

Comments

@mithril52
Copy link

When trying to use Hyperion as the default serializer in Akka 1.3, I get the error below:

=================================================================
System.Reflection.TargetInvocationException occurred
HResult=0x80131604
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Akka.Serialization.Serialization..ctor(ExtendedActorSystem system)
at Akka.Actor.Internal.ActorSystemImpl..ctor(String name, Config config)
at Akka.Actor.ActorSystem.Create(String name, Config config)
at HyperionIssueTestApp.Program.Main(String[] args) in c:\users\b025423\documents\visual studio 2017\Projects\HyperionIssueTestApp\HyperionIssueTestApp\Program.cs:line 31

Inner Exception 1:
MissingMethodException: Method not found: 'Void Hyperion.SerializerOptions..ctor(Boolean, Boolean, System.Collections.Generic.IEnumerable1<Hyperion.Surrogate>, System.Collections.Generic.IEnumerable1<Hyperion.SerializerFactories.ValueSerializerFactory>, System.Collections.Generic.IEnumerable`1<System.Type>)'.

I've attached a simplified project that demonstrates the issue. If I leave the serializer as default, it works fine. Also, Using this same project with 1.2.3 Akka was working fine.

HyperionIssueTestApp.zip

@zbynek001
Copy link
Contributor

Check if you are not referencing older version of hyperion somewhere. Had the same error referencing v0.9.2 instead of v0.9.5.

@mithril52
Copy link
Author

The example project i gave above was a brand new project that had never referenced the previous versions

@blackclavus
Copy link

I had the same issue with my project. I also tried a brand new but same error still appeared.

@zbynek001
Copy link
Contributor

zbynek001 commented Aug 14, 2017

Seems there is something strange. There are two different packages for Hyperion v0.9.5.
I had one cached with

public SerializerOptions(bool versionTolerance = false, bool preserveObjectReferences = false, IEnumerable<Surrogate> surrogates = null, IEnumerable<ValueSerializerFactory> serializerFactories = null, IEnumerable<Type> knownTypes = null)

and when I forced downloading it again, it has

public SerializerOptions(bool versionTolerance = false, bool preserveObjectReferences = false, IEnumerable<Surrogate> surrogates = null, IEnumerable<ValueSerializerFactory> serializerFactories = null, IEnumerable<Type> knownTypes = null, bool ignoreISerializable = false)

Notice the additional ignoreISerializable parameter at the end.

So i seem Akka.Serialization.Hyperion was compiled against the one without ignoreISerializable parameter

Edit:
Also package hawing ignoreISerializable parameter has no debug symbols and the other one has them

@Danthar
Copy link
Member

Danthar commented Aug 14, 2017

I just created a new project. .Net 4.5.2
Akka 1.3
Akka.Serialization.Hyperion 1.3.0-beta46
Hyperion 0.9.5

Works as expected.

Please note we had some issues with our versioning scheme of the pre-releases/beta's. It turns out nuget/myget did not support the scheme which we where using. We didn't noticed this, until very recently.
This might be the reason why you downloaded the wrong version.

@zbynek001
Copy link
Contributor

I've cleaned up all nuget caches and all packages but still the same error.

I've check the Akka.Serialization.Hyperion.dll (1.3.0-beta46), and in IL, it's using the wrong constructor

IL_0071: newobj instance void [Hyperion]Hyperion.SerializerOptions::.ctor(bool,  bool,  class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Hyperion]Hyperion.Surrogate>,  class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Hyperion]Hyperion.SerializerFactories.ValueSerializerFactory>,  class [mscorlib]System.Collections.Generic.IEnumerable`1<class [mscorlib]System.Type>)

@Aaronontheweb
Copy link
Member

@zbynek001 so this is a Hyperion bug then?

@zbynek001
Copy link
Contributor

No, it's in Akka.Serialization.Hyperion package

@Jivko1212
Copy link

Hi, I am getting the same error with Hyperion 0.9.5, Akka.Serialization.Hyperion v1.3.0-beta47 and Akka 1.3.0

@Ralf1108
Copy link
Contributor

Just asked for the error on gitter...

Problem here is that the new optional parameter was introduced but forces all usages (here Akka.Serialization.Hyperion) to be recompiled because the default value will be compiled at the caller site

Would it be an overloaded ctor there would be no problem.

A recompile of "Akka.Serialization.Hyperion" with latest Hyperion package should fix this

@Danthar
Copy link
Member

Danthar commented Aug 17, 2017

Related issue: akkadotnet/Hyperion#71

@Aaronontheweb
Copy link
Member

I can reproduce the error with @mithril52 's sample

@Ralf1108
Copy link
Contributor

@Aaronontheweb
Copy link
Member

image

Props to https://github.com/bitdiffer/bitdiffer

Issue is you have two different versions of Hyperion in your respective projects. I have no idea how that's possible, but we're nuking it from orbit and going to stage a new release of Hyperion 0.9.6 immediately and update the serializer as well.

@zbynek001
Copy link
Contributor

There are two issues:

  1. There are two version of Hyperion v0.9.5 package.
  • Older one without ignoreISerializable parameter
  • New one with ignoreISerializable parameter
  1. and Akka.Serialization.Hyperion was compiled against the older one

Since the older Hyperion package can be already cached, best would be to release a new package version of it first and the recompile Akka.Serialization.Hyperion against it

@Danthar
Copy link
Member

Danthar commented Aug 17, 2017

Ok. The reason it works in my comp. Was because of multiple nuget caches.nuget locals all -clear did the trick for me.

And it fails for me now as well. :P never been so glad to have something fail :P
Meanwhile we also know why this didn't showed up on our test suite. And we are working to push a new version of Akka.Serialization.Hyperion

@Aaronontheweb
Copy link
Member

Issue was that we were compiling against the Hyperion 0.9.5 instance on our MyGet feed instead of the one uploaded to NuGet.org. For whatever reason, they had different versions of the binary.

@Aaronontheweb
Copy link
Member

image

Verified that this is now fixed. Hyperion.dll referenced from src is the same as what's on NuGet.org now.

Danthar added a commit that referenced this issue Aug 17, 2017
close #2976 - dropped ref to nightlies for Hyperion restore
@Aaronontheweb
Copy link
Member

Please install the latest beta of Akka.Serialization.Hyperion, v1.3.0-beta48. This fixes the issue and is compiled with the right binary.

@Ralf1108
Copy link
Contributor

still getting exception with latest "Akka.Serialization.Hyperion 1.3.0-beta48".
what did I miss?

@Aaronontheweb
Copy link
Member

@Ralf1108 can you throw a copy of the package you just downloaded here and do a bin compare like I showed how to do earlier? I'm out of time today to fix this issue, but literally anyone off the street can send a pull request into Akka.NET. I've pointed you in the right direction. Please follow through and send in a PR yourself if this continues to be an issue.

@Ralf1108
Copy link
Contributor

yes, i am already trying to do that

@Ralf1108
Copy link
Contributor

BitDiffer is not able to load the Akka.Serialization.Hyperion.dll correctly because it cant find the missing ctor in Hyperion.
Seems for me that the latest commit didn't work like expected

grafik
The shortened line is:
Method not found: 'Void Hyperion.SerializerOptions..ctor(Boolean, Boolean, System.Collections.Generic.IEnumerable1<Hyperion.Surrogate>, System.Collections.Generic.IEnumerable1<Hyperion.SerializerFactories.ValueSerializerFactory>, System.Collections.Generic.IEnumerable`1<System.Type>)'.

@Ralf1108
Copy link
Contributor

Ralf1108 commented Aug 17, 2017

there still seems to be a cache in the build system which holds the old/broken Hyperion.dll which is used for compilation of the "Akka.Serialization.Hyperion.dll"

@Aaronontheweb
Copy link
Member

Shouldn't be, since we tear down the build server VM after 30 minutes of idle time.

@Aaronontheweb
Copy link
Member

Aaronontheweb commented Aug 17, 2017

@Ralf1108 can you link the exacty CTOR change diff? I'm just going to call that directly so the build server will blow up on compilation if it's wrong.

@Ralf1108
Copy link
Contributor

as said, BitDiffer is not able to show me the diff. I can fiddle it out in the IL code.

You could try to provide the default value for the ctor parameter "ignoreISerializable" in the "Akka.Serialization.Hyperion.dll". If the broken hyperion is used the build should fail.

@Ralf1108
Copy link
Contributor

Ralf1108 commented Aug 17, 2017

offending line in ctors is:

IKnownTypesProvider knownTypesProvider = this.CreateKnownTypesProvider(cDisplayClass40.system, settings.KnownTypesProvider);
bool objectReferences = settings.PreserveObjectReferences;
this._serializer = new Hyperion.Serializer(new SerializerOptions((settings.VersionTolerance ? 1 : 0) != 0, (objectReferences ? 1 : 0) != 0, (IEnumerable<Hyperion.Surrogate>) new Hyperion.Surrogate[1]
{
surrogate
}, (IEnumerable) null, knownTypesProvider.GetKnownTypes()));

IL code shows:

 // IL_004b: call         instance class Akka.Serialization.IKnownTypesProvider Akka.Serialization.HyperionSerializer::CreateKnownTypesProvider(class [Akka]Akka.Actor.ExtendedActorSystem, class [mscorlib]System.Type)
// IL_0050: stloc.2      // 'knownTypesProvider [Range(Instruction(IL_0050 stloc.2)-Instruction(IL_006b ldloc.2))]'
// IL_0051: ldarg.0      // this
// IL_0052: ldarg.2      // settings
// IL_0053: ldfld        bool Akka.Serialization.HyperionSerializerSettings::PreserveObjectReferences
// IL_0058: stloc.3      // 'objectReferences [Range(Instruction(IL_0058 stloc.3)-Instruction(IL_005f ldloc.3))]'
// IL_0059: ldarg.2      // settings
// IL_005a: ldfld        bool Akka.Serialization.HyperionSerializerSettings::VersionTolerance
// IL_005f: ldloc.3      // 'objectReferences [Range(Instruction(IL_0058 stloc.3)-Instruction(IL_005f ldloc.3))]'
// IL_0060: ldc.i4.1     
// IL_0061: newarr       [Hyperion]Hyperion.Surrogate
// IL_0066: dup          
// IL_0067: ldc.i4.0     
// IL_0068: ldloc.1      // 'surrogate [Range(Instruction(IL_003d stloc.1)-Instruction(IL_0068 ldloc.1))]'
// IL_0069: stelem.ref   
// IL_006a: ldnull       
// IL_006b: ldloc.2      // 'knownTypesProvider [Range(Instruction(IL_0050 stloc.2)-Instruction(IL_006b ldloc.2))]'
// IL_006c: callvirt     instance class [mscorlib]System.Collections.Generic.IEnumerable`1<class [mscorlib]System.Type> Akka.Serialization.IKnownTypesProvider::GetKnownTypes()
// IL_0071: newobj       instance void [Hyperion]Hyperion.SerializerOptions::.ctor(bool, bool, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Hyperion]Hyperion.Surrogate>, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Hyperion]Hyperion.SerializerFactories.ValueSerializerFactory>, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [mscorlib]System.Type>)
// IL_0076: newobj       instance void [Hyperion]Hyperion.Serializer::.ctor(class [Hyperion]Hyperion.SerializerOptions)

For me it looks like the default value for the optional parameter was not compiled in, but I am no IL code expert.

@Aaronontheweb
Copy link
Member

see #3003

@zbynek001
Copy link
Contributor

and it actually failed :)
HyperionSerializer.cs(74,21): error CS1739: The best overload for 'SerializerOptions' does not have a parameter named 'ignoreISerializable'

@Ralf1108
Copy link
Contributor

Ralf1108 commented Aug 17, 2017

time for explicit Hyperion 0.9.6 ? ;-)

did you execute the "nuget clean cache" on the build controller?
or is the build vm resetted everytime?

@Aaronontheweb
Copy link
Member

yep, it failed only on the Windows machines that run on bare metal (.4.5)

Reason is... wait for it... The machine was imaged with the old NuGet packaged cached locally.

I'm going to just publish 0.9.6 and move past the issue that way.

@Ralf1108
Copy link
Contributor

then we need a new "Akka.Serialization.Hyperion" as well ;-)

@Aaronontheweb
Copy link
Member

akkadotnet/Hyperion#73 - waiting for another member of @akkadotnet/core to go merge that one :p

@Ralf1108
Copy link
Contributor

Hey guys,

sorry but this issue is not fixed yet, exception still thrown.
The "Akka.Serialization.Hyperion" has to be recompiled and released with the latest Hyperion "0.9.6". Without recompilation the default value for the ctor with the optional parameter is not included in the caller site (here Akka.Serialization.Hyperion).

Releasing a new Hyperion version only fixed the mess with cached older Hyperion versions.
Please check comment from zbynek001: #2976 (comment)

@Aaronontheweb
Copy link
Member

@Ralf1108 yep, we're on it: 059b58a

@Ralf1108
Copy link
Contributor

ups, didn't see that :-)

@Ralf1108
Copy link
Contributor

@Aaronontheweb a recompiled "Akka.Serialization.Hyperion" is also on its way?

@Aaronontheweb
Copy link
Member

Akka.Serialization.Hyperion beta-50 was just published. That will resolve the issue.

@Aaronontheweb
Copy link
Member

I just tried the upgrade on @mithril52's reproduction sample and verified that this issue is indeed resolved by v1.3.0-beta50. Please upgrade.

@Ralf1108
Copy link
Contributor

Yes, can verify that issue is resolved 👍

@jalchr
Copy link

jalchr commented Aug 23, 2017

After upgrading to v1.3, I'm trying to run Lighthouse. I noticed that the LighthouseHostFactory never "reads" the "serialization" config from HOCON.

Topshelf.HostFactory: Configuration Result: [Success] Name Lighthouse [Success] Description Lighthouse Akka.NET Service Discovery [Success] ServiceName Lighthouse Topshelf.HostConfigurators.HostConfiguratorImpl: Topshelf v4.0.0.0, .NET Framework v4.0.30319.42000 Topshelf.Hosts.ConsoleRunHost: An exception occurred System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'Void Hyperion.SerializerOptions..ctor(Boolean, Boolean, System.Collections.Generic.IEnumerable1<Hyperion.Surrogate>, System.Collections.Generic.IEnumerable1<Hyperion.SerializerFactories.ValueSerializerFactory>, System.Collections.Generic.IEnumerable1<System.Type>)'.
at Akka.Serialization.WireSerializer..ctor(ExtendedActorSystem system)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Akka.Serialization.Serialization..ctor(ExtendedActorSystem system)
at Akka.Actor.Internal.ActorSystemImpl..ctor(String name, Config config)
at Akka.Actor.ActorSystem.Create(String name, Config config)
at Lighthouse.LighthouseHostFactory.LaunchLighthouse(String ipAddress, Nullable1 specifiedPort) in C:\Code\Archive\lib\Lighthouse\LighthouseHostFactory.cs:line 80 at Lighthouse.LighthouseService.InitializeCluster() in C:\Code\Archive\lib\Lighthouse\LighthouseService.cs:line 92 at Lighthouse.LighthouseService.Start(HostControl hostControl) in C:\Code\Archive\lib\Lighthouse\LighthouseService.cs:line 46 at Topshelf.Builders.ControlServiceBuilder1.ControlServiceHandle.Start(HostControl hostControl)
at Topshelf.Hosts.ConsoleRunHost.Run()`

I tried to uninstall it ... got this:
Severity Code Description Project File Line Suppression State Error Unable to uninstall 'Hyperion.0.9.6' because 'Akka.Serialization.Wire.1.2.3.407-beta' depends on it. 0

@Ralf1108
Copy link
Contributor

@jalchr seems to be the same issue. Try recompile Lighthouse library with latest Hyperion

@Ralf1108
Copy link
Contributor

@jalchr is it possible, that Lighthouse use latest Akka.Serialization.Hyperion?
https://www.nuget.org/packages/Akka.Serialization.Hyperion/1.3.0-beta50

@Danthar
Copy link
Member

Danthar commented Aug 23, 2017

Lighthouse still needs to be updated afaik.

@jalchr
Copy link

jalchr commented Aug 24, 2017

@Ralf1108 I'm already compiling it against all latest packages. Still getting that error.

What surprised me what that Wire is calling Hyperion O_o

not found: 'Void **Hyperion**.SerializerOptions..ctor(Boolean, Boolean, System.Collections.Generic.IEnumerable1<Hyperion.Surrogate>, System.Collections.Generic.IEnumerable1<Hyperion.SerializerFactories.ValueSerializerFactory>, System.Collections.Generic.IEnumerable1<System.Type>)'. at Akka.Serialization.**WireSerializer**..ctor(ExtendedActorSystem system)

@Aaronontheweb
Copy link
Member

WireSerializer targets Hyperion.

@leo12chandu
Copy link

I am running into the same issue. Currently I am referencing 1.3.3-beta56 for Akka.Serialization.Hyperion and 0.9.8 for Hyperion. If it helps, I have my own custom HyperionSerializer implementing Akka.Serialization.Serializer. Anything I am doing wrong?

The error I get is

Unhandled Exception: System.MissingMethodException: Constructor on type 'SPGMI.D
ata.MTS.Serialization.Hyperion.AkkaHyperionSerializer' not found.
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder bin
der, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCra
wlMark& stackMark)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binde
r binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type, Object[] args)
   at Akka.Serialization.Serialization..ctor(ExtendedActorSystem system)
   at Akka.Actor.Internal.ActorSystemImpl..ctor(String name, Config config)
   at Akka.Actor.ActorSystem.Create(String name, Config config)
   at SPGMI.Services.Data.MTS.SeedNode.LighthouseHostFactory.LaunchLighthouse(St
ring ipAddress, Nullable`1 specifiedPort) in C:\Projects\ContentSystems\Developm
ent\MTS\SPGMI.Data.MTS\SPGMI.Services.Data.MTS.SeedNode\LighthouseHostFactory.cs
:line 56
   at SPGMI.Services.Data.MTS.SeedNode.LighthouseService.Start() in C:\Projects\
ContentSystems\Development\MTS\SPGMI.Data.MTS\SPGMI.Services.Data.MTS.SeedNode\L
ighthouseService.cs:line 26
   at SPGMI.Services.Data.MTS.SeedNode.Program.Main(String[] args) in C:\Project
s\ContentSystems\Development\MTS\SPGMI.Data.MTS\SPGMI.Services.Data.MTS.SeedNode
\Program.cs:line 10

@Horusiath
Copy link
Contributor

@leo12chandu have you specified assembly along with the type in your HOCON serializer config? Or have you defined a public constructor for it? It clearly cannot find the valid constructor.

@leo12chandu
Copy link

That was it, our constructor was not public. Thank You.

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

No branches or pull requests

10 participants