microsoft / FASTER

Fast persistent recoverable log and key-value store + cache, in C# and C++.
https://aka.ms/FASTER
MIT License
6.31k stars 567 forks source link

AOT Support #923

Open ghost-pep opened 3 months ago

ghost-pep commented 3 months ago

Hi! Does FASTER support AOT? When I try to run with AOT I get hanging whenever I try to checkpoint and I assume the library is doing some runtime reflection that is not supported by AOT

henricj commented 4 days ago

WinDbg can be helpful for tracking down such things. For example, Running an AOT-compiled app that uses FasterKV results in a stack trace that starts off like this:

Application failed: System.NotSupportedException: 'FASTER.core.Utility.IsBlittable[System.Byte]()' is missing native code. MethodInfo.MakeGenericMethod() is not compatible with AOT compilation. Inspect and fix AOT related warnings that were generated when the app was published. For more information see https://aka.ms/nativeaot-compatibility
   at System.Reflection.Runtime.MethodInfos.RuntimeNamedMethodInfo`1.GetUncachedMethodInvoker(RuntimeTypeInfo[], MemberInfo) + 0x74
   at System.Reflection.Runtime.MethodInfos.RuntimeNamedMethodInfo`1.MakeGenericMethod(Type[]) + 0x189
   at FASTER.core.Utility.IsBlittableType(Type) + 0x78
   at FASTER.core.FasterEqualityComparer.Get[T]() + 0x105
   at FASTER.core.FasterKV`2..ctor(Int64, LogSettings, CheckpointSettings, SerializerSettings`2, IFasterEqualityComparer`1, VariableLengthStructSettings`2, Boolean, ConcurrencyControlMode, ILoggerFactory, ILogger, Int32) + 0x1ce
   at FASTER.core.FasterKV`2..ctor(FasterKVSettings`2) + 0xa6

This example probably not directly relevant for the base FASTER library.