Legacy UseConfiguration doesn't properly set DynamoDBReminderStorageOptions
#4,656 建立於 2018年6月6日
倉庫指標
- 星標
- (10,777 顆星)
- PR 合併指標
- (平均合併 2天 2小時) (30 天內合併 64 個 PR)
描述
Upgrading from 2.0.0-beta3 I've observed:
Orleans.Runtime.OrleansLifecycleCanceledException: 'Lifecycle start canceled due to errors at stage 20000'
InnerException | {System.ArgumentNullException: Value cannot be null. Parameter name: service at Orleans.Reminders.DynamoDB.DynamoDBStorage..ctor(ILoggerFactory loggerFactory, String service, String accessKey, String secretKey, Int32 readCapacityUnits, Int32 writeCapacityUnits) at Orleans.Reminders.DynamoDB.DynamoDBReminderTable.Init() at Orleans.Runtime.ReminderService.LocalReminderService.d__16.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.Runtime.Scheduler.AsyncClosureWorkItem.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.OrleansTaskExtentions.d__16.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.Runtime.Silo.<g__StartReminderService73_0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.Runtime.Silo.d__69.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.Runtime.Silo.d__73.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.Runtime.SiloLifecycleSubject.MonitoredObserver.d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.LifecycleSubject.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.LifecycleSubject.d__4.MoveNext()} | System.Exception {System.ArgumentNullException}
This seems to be caused by the DynamoDBReminderStorageOptions object not properly being configured when using the legacy extension method UseConfiguration. DynamoDBClusteringOptions does get properly set however.
After manually setting these fields via UseDynamoDBReminderService() everything works:
DynamoDBClusteringOptions clusteringOptions = null;
var siloBuilder = new SiloHostBuilder()
.ConfigureApplicationParts(appParts =>
{
appParts.AddFromApplicationBaseDirectory().WithReferences();
appParts.AddFromAppDomain().WithReferences();
})
.UseConfiguration(config)
.UseDynamoDBClustering((DynamoDBClusteringOptions options) =>
{
// We don't need to do configuring in here because the legacy
// .UseConfiguration still handles it for us (for now)
clusteringOptions = options;
})
.UseDynamoDBReminderService((DynamoDBReminderStorageOptions options) =>
{
// Unfortunately, there's seems to be a a bug in Orleans that doesn't
// propagate the same clustering options to the reminder storage options
options.Service = clusteringOptions.Service;
options.AccessKey = clusteringOptions.AccessKey;
options.SecretKey = clusteringOptions.SecretKey;
});