-
Notifications
You must be signed in to change notification settings - Fork 111
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
[BUG] With Parallelism on same key with GetOrSetAsync and Redis as backplane #361
Comments
Hi @ilioan , that's strange and seems like a protobuf-net specific thing. |
ps: would you be able to create an MRE? |
I ll try but I need few days to prepare it. |
Meanwhile I found this. Will try to reproduce it locally. |
UPDATE: I think I've found the cause, it's probably a missing check in (what should've been) a classic double-checked lock, here. Will make some tests before/after and update you. |
It was easier for me to change the Serializer to FusionCacheNewtonsoftJsonSerializer and test. |
` public async Task Test()
GetAsync calls GetOrSetAsync with Redis Backplane With FusionCacheNewtonsoftJsonSerializer works. System.InvalidOperationException: Duplicate field-number detected; 1 on: ZiggyCreatures.Caching.Fusion.Internals.Distributed.FusionCacheDistributedEntry |
Hi @ilioan , thanks! Will update soon. |
Describe the bug
After updating to version 2.0.0 from 1.4.1
When I am using Tasks.WhenAll (Parellelism)
Inside tasks I have two calls on the same key with GetOrSetAsync with distributed backplane redis.
then I got an error of duplicate key. No cache entry at Redis backplane.
System.InvalidOperationException: Duplicate field-number detected; 1 on: ZiggyCreatures.Caching.Fusion.Internals.Distributed.FusionCacheDistributedEntry
1[[System.Int64, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] at ProtoBuf.Internal.Serializers.TypeSerializer
1.Init(Int32[] fieldNumbers, IRuntimeProtoSerializerNode[] serializers, MethodInfo[] baseCtorCallbacks, Boolean isRootType, Boolean useConstructor, Boolean assertKnownType, CallbackSet callbacks, Type constructType, MethodInfo factory, SerializerFeatures features) in //src/protobuf-net/Internal/Serializers/TypeSerializer.cs:line 204at ProtoBuf.Internal.Serializers.TypeSerializer.Create(Type forType, Int32[] fieldNumbers, IRuntimeProtoSerializerNode[] serializers, MethodInfo[] baseCtorCallbacks, Boolean isRootType, Boolean useConstructor, Boolean assertKnownType, CallbackSet callbacks, Type constructType, MethodInfo factory, Type rootType, SerializerFeatures features) in //src/protobuf-net/Internal/Serializers/TypeSerializer.cs:line 21
at ProtoBuf.Meta.MetaType.BuildSerializer() in //src/protobuf-net/Meta/MetaType.cs:line 625
at ProtoBuf.Meta.MetaType.get_Serializer() in //src/protobuf-net/Meta/MetaType.cs:line 465
at ProtoBuf.Meta.RuntimeTypeModel.g__GetServicesImpl|88_0(RuntimeTypeModel model, Type type, CompatibilityLevel ambient) in //src/protobuf-net/Meta/RuntimeTypeModel.cs:line 1033
at ProtoBuf.Meta.RuntimeTypeModel.GetServicesSlow(Type type, CompatibilityLevel ambient) in //src/protobuf-net/Meta/RuntimeTypeModel.cs:line 999
at ProtoBuf.Meta.RuntimeTypeModel.GetSerializerT in //src/protobuf-net/Meta/RuntimeTypeModel.cs:line 962
at ProtoBuf.Meta.TypeModel.TryGetSerializer[T](TypeModel model) in //src/protobuf-net.Core/Meta/TypeModel.cs:line 1486
at ProtoBuf.Meta.TypeModel.SerializeImpl[T](State& state, T value) in //src/protobuf-net.Core/Meta/TypeModel.cs:line 377
at ProtoBuf.Meta.TypeModel.Serialize[T](Stream dest, T value, Object userState) in //src/protobuf-net.Core/Meta/TypeModel.cs:line 328
at ZiggyCreatures.Caching.Fusion.Serialization.ProtoBufNet.FusionCacheProtoBufNetSerializer.Serialize[T](T obj) in //src/ZiggyCreatures.FusionCache.Serialization.ProtoBufNet/FusionCacheProtoBufNetSerializer.cs:line 107
at ZiggyCreatures.Caching.Fusion.Serialization.ProtoBufNet.FusionCacheProtoBufNetSerializer.SerializeAsync[T](T obj, CancellationToken token) in //src/ZiggyCreatures.FusionCache.Serialization.ProtoBufNet/FusionCacheProtoBufNetSerializer.cs:line 125
at ZiggyCreatures.Caching.Fusion.Internals.Distributed.DistributedCacheAccessor.SetEntryAsync[TValue](String operationId, String key, IFusionCacheEntry entry, FusionCacheEntryOptions options, Boolean isBackground, CancellationToken token) in /_/src/ZiggyCreatures.FusionCache/Internals/Distributed/DistributedCacheAccessor_Async.cs:line 85
To Reproduce
Here's a MRE (Minimal Reproducible Example) of the issue:
Expected behavior
At previous version it was working perfect. At Redis cache the key was added normally.
Now seems that the key was added at memory but not on Redis backplane.
Versions
I've encountered this issue on:
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: