Unintuitive error when client setup to use TLS and Silo is Not.
- Dominant language
- C#
- Stars
- 10.9k
- Forks
- 2.1k
- Avg merge
- 13h 56m
- Merged PRs (30d)
- 351
Description
Error from Silo:
```
[07:54:57 DBG] Connection id "0HMF0P8SN4092" received FIN.
[07:54:57 WRN] Error processing connection [Local: 172.16.1.20:30000, Remote: 172.16.1.20:52169, ConnectionId: 0HMF0P8SN4092]
System.InvalidOperationException: Connection terminated prematurely
at Orleans.Runtime.Messaging.ConnectionPreamble.g__CheckForCompletion|3_1(ReadResult& r) in /_/src/Orleans.Core/Networking/ConnectionPreamble.cs:line 136
at Orleans.Runtime.Messaging.ConnectionPreamble.Read(ConnectionContext connection) in /_/src/Orleans.Core/Networking/ConnectionPreamble.cs:line 68
at Orleans.Runtime.Messaging.GatewayInboundConnection.ProcessConnection() in /_/src/Orleans.Runtime/Networking/GatewayInboundConnection.cs:line 121
at Orleans.Runtime.Messaging.Connection.Run() in /_/src/Orleans.Core/Networking/Connection.cs:line 185
[07:54:57 DBG] Connection id "0HMF0P8SN4092" sending FIN because: "The Socket transport's send loop completed gracefully."
[07:54:57 INF] Connection [Local: 172.16.1.20:30000, Remote: 172.16.1.20:52169, ConnectionId: 0HMF0P8SN4092] terminated
[07:54:57 DBG] Connection id "0HMF0P8SN4093" received FIN.
```
Config:
```
siloBuilder
.ConfigureServices(
(context, services) =>
{
services.Configure(context.Configuration);
services.Configure(context.Configuration.GetSection(nameof(ApplicationOptions.ClusterMembership)));
services.Configure(context.Configuration.GetSection(nameof(ApplicationOptions.Cluster)));
services.Configure(context.Configuration.GetSection(nameof(ApplicationOptions.Storage)));
})
.UseSiloUnobservedExceptionsHandler()
.UseAdoNetClustering(options =>
{
options.Invariant = GetStorageOptions(context.Configuration).Invariant;
options.ConnectionString = GetStorageOptions(context.Configuration).ConnectionString;
})
.ConfigureEndpoints(
EndpointOptions.DEFAULT_SILO_PORT,
EndpointOptions.DEFAULT_GATEWAY_PORT,
listenOnAnyHostAddress: !context.HostingEnvironment.IsDevelopment())
.ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(StorageHealthCheckGrain).Assembly).WithReferences())
.AddAdoNetGrainStorageAsDefault(options =>
{
options.Invariant = GetStorageOptions(context.Configuration).Invariant;
options.ConnectionString = GetStorageOptions(context.Configuration).ConnectionString;
options.ConfigureJsonSerializerSettings = ConfigureJsonSerializerSettings;
options.UseJsonFormat = true;
})
.AddAdoNetGrainStorage(GrainStorageProviderName.ScheduledTaskMetadata, options =>
{
options.Invariant = GetStorageOptions(context.Configuration).Invariant;
options.ConnectionString = GetStorageOptions(context.Configuration).ConnectionString;
options.ConfigureJsonSerializerSettings = ConfigureJsonSerializerSettings;
options.UseJsonFormat = true;
})
.UseAdoNetReminderService(options =>
{
options.Invariant = GetStorageOptions(context.Configuration).Invariant;
options.ConnectionString = GetStorageOptions(context.Configuration).ConnectionString;
})
//.UseTransactions(withStatisticsReporter: true)
//.AddAzureTableTransactionalStateStorageAsDefault(
// options => options.ConnectionString = GetStorageOptions(context.Configuration).ConnectionString)
.AddSimpleMessageStreamProvider(StreamProviderName.Default)
.AddAdoNetGrainStorage(
"PubSubStore",
options =>
{
options.Invariant = GetStorageOptions(context.Configuration).Invariant;
options.ConnectionString = GetStorageOptions(context.Configuration).ConnectionString;
options.ConfigureJsonSerializerSettings = ConfigureJsonSerializerSettings;
options.UseJsonFormat = true;
})
.UseIf(
RuntimeInformation.IsOSPlatform(OSPlatform.Linux),
x => x.UseLinuxEnvironmentStatistics())
.UseIf(
RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
x => x.UsePerfCounterEnvironmentStatistics())
.UseDashboard();
```
Client:
```
Orleans.Networking.Shared.SocketConnectionException: Unable to connect to 172.16.1.20:30000. Error: ConnectionRefused
at Orleans.Networking.Shared.SocketConnectionFactory.ConnectAsync(EndPoint endpoint, CancellationToken cancellationToken) in /_/src/Orleans.Core/Networking/Shared/SocketConnectionFactory.cs:line 52
at Orleans.Runtime.Messaging.ConnectionFactory.ConnectAsync(SiloAddress address, CancellationToken cancellationToken) in /_/src/Orleans.Core/Networking/ConnectionFactory.cs:line 53
at Orleans.Internal.OrleansTaskExtentions.MakeCancellable[T](Task`1 task, CancellationToken cancellationToken)
at Orleans.Runtime.Messaging.ConnectionManager.ConnectAsync(SiloAddress address) in /_/src/Orleans.Core/Networking/ConnectionManager.cs:line 262
```
Setup:
```
this.Client = new ClientBuilder()
.UseAdoNetClustering(options =>
{
options.Invariant = this.options.Storage.Invariant;
options.ConnectionString = this.options.Storage.ConnectionString;
})
.Configure(options =>
{
options.ClusterId = this.options.Cluster.ClusterId;
options.ServiceId = this.options.Cluster.ServiceId;
})
.ConfigureApplicationParts(
parts => parts
.AddApplicationPart(typeof(Abstractions.Grains.HealthChecks.ILocalHealthCheckGrain).Assembly)
.WithReferences())
.UseTls(
options =>
{
// TODO: Configure a certificate.
options.LocalCertificate = null;
// TODO: Do not allow any remote certificates in production.
options.AllowAnyRemoteCertificate();
})
.Build();
```
Contributor guide
Assessment
This issue has not been assessed yet.