Unsupported type 'Orleans.Streams.PubSubGrainState' encountered.
After orleans upgrade from 1.3.1 to 1.4.1 we get the following error on silo start:
2017-05-22-13.35.13.812ZZ ERROR starting Orleans silo name=Ucp.Sde.Cloud.WorkerRole_IN_1 Exception= Exc level 0: System.AggregateException: One or more errors occurred. at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait(TimeSpan timeout) at Orleans.OrleansTaskExtentions.WaitWithThrow(Task task, TimeSpan timeout) at Orleans.Runtime.Silo.DoStart() at Orleans.Runtime.Silo.Start() at Orleans.Runtime.Host.SiloHost.StartOrleansSilo(Boolean catchExceptions) Exc level 1: Orleans.Providers.ProviderInitializationException: Exception initializing provider Name=TrafficStatsticsBootstrapper Type=[TrafficStatsticsBootstrapper, KasperskyLab.Ucp.Sde.TrafficStatistic.TrafficStatsticsBootstrapper] at Orleans.Providers.ProviderLoader
1.<InitProviders>d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.Runtime.BootstrapProviderManager.PluginManager1.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.Runtime.BootstrapProviderManager. d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.Runtime.Scheduler.SchedulerExtensions.<>c__DisplayClass1_0.< b__0>d.MoveNext() Exc level 2: Orleans.Runtime.OrleansException: Forwarding failed: tried to forward message Request S100.73.118.72:11111:233156068grn/B23D7E1F/00000000@893f1db4->S100.73.118.72:11111:233156068grn/716E8E94/477e64bb+AzureQueueProvider_VpnAccessEvents@3b49d1ab #32[ForwardCount=2]: global::Orleans.Streams.IPubSubRendezvousGrain:GetAllSubscriptions() for 2 times after Failed SetupActivationState to invalid activation. Rejecting now. System.AggregateException: Unable to convert from storage format GrainStateEntity.Data=System.Byte[] ---> System.Runtime.Serialization.SerializationException: Unsupported type 'Orleans.Streams.PubSubGrainState' encountered. Perhaps you need to mark it [Serializable] or define a custom serializer for it? at Orleans.Serialization.SerializationManager.DeserializeInner(Type expected, IDeserializationContext context) at Orleans.Serialization.SerializationManager.DeserializeInner[T](IDeserializationContext context) at Orleans.Serialization.SerializationManager.DeserializeFromByteArray[T](Byte[] data) at Orleans.Storage.AzureTableStorage.ConvertFromStorageFormat(DynamicTableEntity entity) --- End of inner exception stack trace --- at Orleans.Storage.AzureTableStorage.ConvertFromStorageFormat(DynamicTableEntity entity) at Orleans.Storage.AzureTableStorage. d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at KasperskyLab.Ucp.Sde.Backend.Infrastructure.Orleans.Storage.CloudTableStorageProvider. d__11.MoveNext() in F:\vNext_KpcInfraSdePool\Agent10_work\1\s\src\Ucp.Sde.Backend.Infrastructure\Orleans\Storage\CloudTableStorageProvider.cs:line 99 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.Runtime.Scheduler.SchedulerExtensions.<>c__DisplayClass1_0.< b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.Runtime.Catalog. d__63.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.Runtime.Catalog. d__59.MoveNext() ---> (Inner Exception #0) System.Runtime.Serialization.SerializationException: Unsupported type 'Orleans.Streams.PubSubGrainState' encountered. Perhaps you need to mark it [Serializable] or define a custom serializer for it? at Orleans.Serialization.SerializationManager.DeserializeInner(Type expected, IDeserializationContext context) at Orleans.Serialization.SerializationManager.DeserializeInner[T](IDeserializationContext context) at Orleans.Serialization.SerializationManager.DeserializeFromByteArray[T](Byte[] data) at Orleans.Storage.AzureTableStorage.ConvertFromStorageFormat(DynamicTableEntity entity)
@ar3cka Do you use Azure Table storage provider for PubSub with binary format?
@DixonDs Yes, we do. But we have written a wrapper storage provider (like was suggested in #1872) and use it for reading data with backward compatibility problems.
@ar3cka Do you have that storage provider added as "PubSubStore"?
@sergeybykov Yes, we use it as "Default" and "PubSubStore" storage provider.
What stream provider are you using? We may be able to reproduce this on our side once we know what stream provider you're using.
Since this is happening during deserialization, it seems most likely that something has changed between what was stored in pubsub in 1.3.1 and 1.4.1. I assume the 1.4.1 version can read the state it writes?
From the code, it does not look like the pubsub state has changed between the versions, but something clearly has, so the question in my mind is "what's different?". To help figure this out, I suggest:
- Run the current 1.3.1 code in a clean environment, with the storage configured to store state in json format.
- Run the new 1.4.1 version, also in a clean environment with the storage similarly configured.
- Compare pubsub json states between the two versions and look for data format differences that could account for the serialization errors.
Minor curiosity: Why move to 1.4.1 rather than 1.4.2?
@jason-bragg
Minor curiosity: Why move to 1.4.1 rather than 1.4.2?
There is no 1.4.2 and 1.4.1 is the latest stable version.
@DixonDs
no 1.4.2
Oops. We have a branch for 1.4.2, so I assumed we did a release, my mistake. NM :)
It is strange that it throws exception when deserialize on PubSubGrainState class, Since the class structure itself doesn't change between 1.3.1 and 1.4.1, and its member class's serialized properties between two versions doesn't change either, except for GrainReference. But if the serialization problem lies on GrainReference, then you should be seeing more serialization exception regarding grains in general , rather than just PubSubGrainState class.
I suspect it can be related to serialization itself. There's a lot more changes in serialization between the two versions than in streaming. what serializer are you using when moving from 1.3 to 1.4.1? Are you using a different one?
@jason-bragg @xiazen We are using AzureQueueStreamProvider with the builtin binary serializer. I've checked migration on clean environment and found out, that issue happens only for binary serialization. There are no issues if we use json serialization.
@ReubenBond has reproduced the issue and has a preliminary fix, though he's still considering other solutions. This will most likely necessitate a 1.4.2 release. We've not yet identified a workaround you can apply in 1.4.1. :/
Should be fixed via #3035.