-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Description
Which Umbraco version are you using?
16.2.0
Bug summary
When Umbraco site boots up to do Cache seeding it reports a Cache deserialization error with JSON
Specifics
Video
Error
[14:49:51 ERR] Cache deserialization failure.
System.Text.Json.JsonException: '0x93' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
---> System.Text.Json.JsonReaderException: '0x93' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)
at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first)
at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
at System.Text.Json.Utf8JsonReader.Read()
at System.Text.Json.JsonSerializer.GetReaderScopedToNextValue(Utf8JsonReader& reader, ReadStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
at System.Text.Json.JsonSerializer.GetReaderScopedToNextValue(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.Read[TValue](Utf8JsonReader& reader, JsonTypeInfo`1 jsonTypeInfo)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultJsonSerializerFactory.DefaultJsonSerializer`1.Microsoft.Extensions.Caching.Hybrid.IHybridCacheSerializer<T>.Deserialize(ReadOnlySequence`1 source)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultHybridCache.MutableCacheItem`1.TryGetValue(ILogger log, T& value)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultHybridCache.CacheItem`1.GetReservedValue(ILogger log)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultHybridCache.StampedeState`2.<UnwrapReservedAsync>g__AwaitedAsync|18_0(ILogger log, Task`1 task)
at Umbraco.Cms.Infrastructure.HybridCache.Extensions.HybridCacheExtensions.TryGetValueAsync[T](HybridCache cache, String key)
at Umbraco.Cms.Infrastructure.HybridCache.Extensions.HybridCacheExtensions.ExistsAsync(HybridCache cache, String key)
at Umbraco.Cms.Infrastructure.HybridCache.Services.DocumentCacheService.SeedAsync(CancellationToken cancellationToken)
at Umbraco.Cms.Infrastructure.HybridCache.NotificationHandlers.SeedingNotificationHandler.HandleAsync(UmbracoApplicationStartedNotification notification, CancellationToken cancellationToken)
at Umbraco.Cms.Core.Events.INotificationAsyncHandler`1.HandleAsync(IEnumerable`1 notifications, CancellationToken cancellationToken)
at Umbraco.Cms.Core.Events.EventAggregator.PublishCoreAsync[TNotification](IEnumerable`1 allHandlers, IEnumerable`1 notifications, CancellationToken cancellationToken)
[14:49:51 FTL] An error occurred starting the application
System.AggregateException: One or more errors occurred. (One or more errors occurred. ('0x93' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.))
---> System.AggregateException: One or more errors occurred. ('0x93' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.)
---> System.Text.Json.JsonException: '0x93' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
---> System.Text.Json.JsonReaderException: '0x93' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)
at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first)
at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
at System.Text.Json.Utf8JsonReader.Read()
at System.Text.Json.JsonSerializer.GetReaderScopedToNextValue(Utf8JsonReader& reader, ReadStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
at System.Text.Json.JsonSerializer.GetReaderScopedToNextValue(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.Read[TValue](Utf8JsonReader& reader, JsonTypeInfo`1 jsonTypeInfo)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultJsonSerializerFactory.DefaultJsonSerializer`1.Microsoft.Extensions.Caching.Hybrid.IHybridCacheSerializer<T>.Deserialize(ReadOnlySequence`1 source)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultHybridCache.MutableCacheItem`1.TryGetValue(ILogger log, T& value)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultHybridCache.CacheItem`1.GetReservedValue(ILogger log)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultHybridCache.StampedeState`2.<UnwrapReservedAsync>g__AwaitedAsync|18_0(ILogger log, Task`1 task)
at Umbraco.Cms.Infrastructure.HybridCache.Extensions.HybridCacheExtensions.TryGetValueAsync[T](HybridCache cache, String key)
at Umbraco.Cms.Infrastructure.HybridCache.Extensions.HybridCacheExtensions.ExistsAsync(HybridCache cache, String key)
at Umbraco.Cms.Infrastructure.HybridCache.Services.DocumentCacheService.SeedAsync(CancellationToken cancellationToken)
at Umbraco.Cms.Infrastructure.HybridCache.NotificationHandlers.SeedingNotificationHandler.HandleAsync(UmbracoApplicationStartedNotification notification, CancellationToken cancellationToken)
at Umbraco.Cms.Core.Events.INotificationAsyncHandler`1.HandleAsync(IEnumerable`1 notifications, CancellationToken cancellationToken)
at Umbraco.Cms.Core.Events.EventAggregator.PublishCoreAsync[TNotification](IEnumerable`1 allHandlers, IEnumerable`1 notifications, CancellationToken cancellationToken)
at Umbraco.Cms.Core.Events.NotificationAsyncHandlerWrapperImpl`1.HandleAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken, ServiceFactory serviceFactory, Func`4 publish)
at Umbraco.Cms.Core.Events.EventAggregator.PublishNotificationsAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.WaitAllCore(ReadOnlySpan`1 tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.WaitAll(ReadOnlySpan`1 tasks)
at Umbraco.Cms.Core.Events.EventAggregator.Publish[TNotification,TNotificationHandler](IEnumerable`1 notifications)
at Umbraco.Cms.Core.Events.EventAggregator.Publish[TNotification](TNotification notification)
at Umbraco.Cms.Infrastructure.Runtime.CoreRuntime.<StartAsync>b__20_1()
at System.Threading.CancellationTokenSource.Invoke(Delegate d, Object state, CancellationTokenSource source)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException)
--- End of inner exception stack trace ---
at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException)
at Microsoft.Extensions.Hosting.Internal.ApplicationLifetime.NotifyStarted()
Steps to reproduce
- Install Umbraco 16.2.0
- Install Clean Starterkit from Paul Seal
- Boot up site
- Grab ContentType keys for Homenode and Articles (Blog posts)
- Use Docker and run Redis locally
docker run -d --name redis -p 6379:6379 redis:latest - Install Redis Insight Desktop tool & connect to instance with connection
127.0.0.1:6379
https://github.com/redis/RedisInsight
https://stackoverflow.com/a/76791678 - Stop Umbraco site and add to Program.cs after Umbraco bits but before final builder.Build()
// Hybrid Cache Adding in 2nd level cache (distributed cache) with Redis
// This is an example with a localhost docker instance to see/view entries
// Uses 'Microsoft.Extensions.Caching.StackExchangeRedis' nuget package
builder.Services.AddStackExchangeRedisCache(options =>
{
options.Configuration = builder.Configuration.GetConnectionString("RedisConnectionString");
});- Update appsettings.development.json with Redis Connection string
"ConnectionStrings": {
"umbracoDbDSN": "Data Source=|DataDirectory|/Umbraco.sqlite.db;Cache=Shared;Foreign Keys=True;Pooling=True",
"umbracoDbDSN_ProviderName": "Microsoft.Data.Sqlite",
"RedisConnectionString": "127.0.0.1:6379"
},- Update appsettings.development.json with Cache config such as this (using correct keys)
"Cache": {
"ContentTypeKeys": [
"a95360e8-ff04-40b1-8f46-7aa4b5983096", // homepage doctype
"0f63b49a-5423-46bd-91fa-0e78bbd2f6d6" // article (blog posts) doctype
],
"DocumentBreadthFirstSeedCount": 25, // default is 100
"DocumentSeedBatchSize": 100 // default is 100
}Expected result / actual result
No error to happen in the logs about Cache serialization and that the data can be viewed correctly from Redis Insight tool when we set the type of data as MessagePack
This item has been added to our backlog AB#57415