-
Describe the issueWhen If Steps to reproduce
using Microsoft.Extensions.Caching.Distributed;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddStackExchangeRedisCache(options =>
{
options.Configuration = "127.0.0.1:6379,DefaultDatabase=0";
});
builder.Services.AddHostedService<StartupService>();
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.Run();
public class StartupService(IDistributedCache cache, ILogger<StartupService> logger) : IHostedService
{
public async Task StartAsync(CancellationToken cancellationToken)
{
//var value = new string('1', 1024 * 1024 * 4 - 88); // OK
var value = new string('1', 1024 * 1024 * 4 - 87); // RedisConnectionException
await cache.SetStringAsync("1", value).ContinueWith(p =>
{
if (p.IsFaulted)
{
logger.LogError($"Error setting cache");
if (p.Exception is AggregateException ae)
{
logger.LogError(ae.InnerException, $"Error setting cache");
}
}
});
}
public Task StopAsync(CancellationToken cancellationToken)
{
return Task.CompletedTask;
}
}
Expected behaviorThe value should be stored successfully without closing the connection. Actual behaviorConnection is closed during the write operation, producing this error: Log from Garnet.worker.exe Environment
Questions
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Try adjusting the PageSize, ObjectStorePageSize or AofPageSize accordingly. |
Beta Was this translation helpful? Give feedback.
-
|
The call stack you posted says HSET was being called, whereas your repro shows SET is being invoked. Just double checking to make sure this isn't a problem, rather is just a mismatch between your repro and your error log. |
Beta Was this translation helpful? Give feedback.
Try adjusting the PageSize, ObjectStorePageSize or AofPageSize accordingly.
In your case I think it is the AofPageSize.