Fix corrupted bytes sent after GOAWAY - #2766
Conversation
|
|
|
This looks like it creates a new serialization context every time. That will hurt performance of streaming calls. Instead of reusing a context for each streamed message, a new context is created. In ASP.NET Core we reuse a HttpContext if it completed successfully, otherwise it is thrown away. Can the same thing be done here? If there is an error then don't reuse the serialization context. |
JamesNK
left a comment
There was a problem hiding this comment.
The correctness fix is validated: the focused concurrent-write test fails on the base commit (Expected: 1, But was: 2) and passes on this head, and the complete GrpcCallSerializationContextTests fixture passes (18/18). I also ran the issue #2760 GOAWAY reproduction against both versions: base detected corrupted payload bytes, while this head completed 100 iterations with at least 38,000 retried payloads verified and no corruption.
The remaining issue before merge is the streaming allocation regression noted in my earlier comment. PR #1033 deliberately introduced serialization-context reuse for streaming; this change replaces one context per call with one context per message. Please preserve reuse for the sequential path while isolating overlaps. A per-call single-slot lease is sufficient: atomically take the cached context, allocate only when the slot is already leased, reset after use, and atomically return at most one clean context. That avoids a global pool and timeout cleanup while retaining the concurrency fix.
|
One way to preserve reuse without sharing an active context is a per- For example, the helper could look roughly like this: private GrpcCallSerializationContext? _serializationContext;
internal SerializationContextLease RentSerializationContext(CallOptions callOptions)
{
var context = Interlocked.Exchange(ref _serializationContext, null)
?? new GrpcCallSerializationContext(this);
try
{
context.CallOptions = callOptions;
context.Initialize();
return new SerializationContextLease(this, context);
}
catch
{
context.Reset();
throw; // Don't cache a context after initialization fails.
}
}
private void ReturnSerializationContext(GrpcCallSerializationContext context)
{
// Keep at most one context. A concurrent extra is left for GC.
Interlocked.CompareExchange(ref _serializationContext, context, null);
}
internal struct SerializationContextLease : IDisposable
{
private readonly GrpcCall _call;
private GrpcCallSerializationContext? _context;
private bool _reusable;
internal SerializationContextLease(GrpcCall call, GrpcCallSerializationContext context)
{
_call = call;
_context = context;
_reusable = false;
}
public readonly GrpcCallSerializationContext Context => _context!;
public void MarkReusable() => _reusable = true;
public void Dispose()
{
var context = _context;
if (context == null)
{
return;
}
_context = null;
context.Reset(); // Always release the rented payload buffer.
if (_reusable)
{
_call.ReturnSerializationContext(context);
}
}
}A call site then contains only the operation-specific work: var lease = call.RentSerializationContext(callOptions);
try
{
serializer(message, lease.Context);
await stream.WriteAsync(
lease.Context.GetWrittenPayload(),
call.CancellationToken).ConfigureAwait(false);
lease.MarkReusable();
}
finally
{
lease.Dispose();
}This gives us one allocation for the normal sequential streaming path, independent contexts for overlapping replay writes, at most one retained context after concurrent successes, and no reuse following serialization, initialization, or write errors. The same helper can be used by the retry and WinHTTP serialization paths. I would avoid a helper that accepts |
|
Thanks @JamesNK! I applied your suggestion, and included tests. It will definitely help reduce amount of allocations specifically for the non-contested paths where we would reuse same context over and over again. |
JamesNK
left a comment
There was a problem hiding this comment.
The follow-up resolves the streaming allocation concern while keeping overlapping serialization attempts isolated. The single-slot lease is removed atomically while active, failed operations are not cached, and retry payloads are copied before the context is returned.
Validation on aff70593:
Grpc.Net.Clientbuilds successfully for all six target frameworks with no warnings or errors.- Focused tests pass on .NET 10 (89/89) and .NET Framework 4.6.2 (57/57), including sequential reuse, overlapping leases, failed-reuse behavior, concurrent payload independence, retry, streaming, and compression coverage.
- A public
GrpcChannelclient-streaming probe validated 5,200 framed messages with no corruption; 200 concurrent unary messages also validated with no corruption. - The same 5,000-message streaming probe allocated about 127.9 fewer bytes per message than
2196f66, confirming the per-messageGrpcCallSerializationContextallocation has been removed.
The earlier issue #2760 GOAWAY stress result remains valid for the unchanged isolation behavior (100 iterations and at least 38,000 retried payloads without corruption). The harness was not available to rerun for this follow-up; native WinHTTP was also not exercised directly.
Updated [Dapper](https://github.com/DapperLib/Dapper) from 2.1.86 to 2.1.89. <details> <summary>Release notes</summary> _Sourced from [Dapper's releases](https://github.com/DapperLib/Dapper/releases)._ ## 2.1.89 ## What's Changed * Fully sign the StrongName assemblies on every platform by @mgravell in DapperLib/Dapper#2237 * Suppress trim and AOT diagnostics in Dapper fallback paths by @JamesNK in DapperLib/Dapper#2233 * Run the main build on every push to main, not just root-file pushes by @mgravell in DapperLib/Dapper#2238 ## New Contributors * @JamesNK made their first contribution in DapperLib/Dapper#2233 **Full Changelog**: DapperLib/Dapper@2.1.86...2.1.89 Commits viewable in [compare view](DapperLib/Dapper@2.1.86...2.1.89). </details> Updated [Grpc.AspNetCore](https://github.com/grpc/grpc-dotnet) from 2.83.0 to 2.84.0. <details> <summary>Release notes</summary> _Sourced from [Grpc.AspNetCore's releases](https://github.com/grpc/grpc-dotnet/releases)._ ## 2.84.0 ## What's Changed * Document complete release version updates by @JamesNK in grpc/grpc-dotnet#2748 * Bump axios from 1.16.0 to 1.18.1 in /testassets/InteropTestsGrpcWebWebsite/Tests by @dependabot[bot] in grpc/grpc-dotnet#2745 * Bump fast-uri from 3.1.2 to 3.1.4 in /examples/Browser/Server/wwwroot by @dependabot[bot] in grpc/grpc-dotnet#2749 * Avoid blocking SemaphoreSlim.Wait(0) on single-threaded browser WASM by @pavelsavara in grpc/grpc-dotnet#2756 * Update package dependencies and examples by @JamesNK in grpc/grpc-dotnet#2759 * Bump fast-uri from 3.1.4 to 3.1.5 in /examples/Browser/Server/wwwroot by @dependabot[bot] in grpc/grpc-dotnet#2754 * Bump brace-expansion in /testassets/InteropTestsGrpcWebWebsite/Tests by @dependabot[bot] in grpc/grpc-dotnet#2755 * Bump ip-address from 10.2.0 to 10.5.0 in /testassets/InteropTestsGrpcWebWebsite/Tests by @dependabot[bot] in grpc/grpc-dotnet#2757 * Stabilize unobserved exception retry test by @JamesNK in grpc/grpc-dotnet#2758 * Fix corrupted bytes sent after GOAWAY by @DeagleGross in grpc/grpc-dotnet#2766 * Bump fast-uri from 3.1.5 to 3.1.7 in /examples/Browser/Server/wwwroot by @dependabot[bot] in grpc/grpc-dotnet#2761 * Bump js-yaml in /testassets/InteropTestsGrpcWebWebsite/Tests by @dependabot[bot] in grpc/grpc-dotnet#2765 * Bump joi from 17.13.4 to 17.13.7 in /testassets/InteropTestsGrpcWebWebsite/Tests by @dependabot[bot] in grpc/grpc-dotnet#2764 * Bump baseline-browser-mapping from 2.9.19 to 2.11.21 in /examples/Browser/Server/wwwroot by @dependabot[bot] in grpc/grpc-dotnet#2763 * Bump browserslist from 4.25.1 to 4.28.8 in /testassets/InteropTestsGrpcWebWebsite/Tests by @dependabot[bot] in grpc/grpc-dotnet#2762 * Bump @babel/core from 7.28.0 to 7.29.7 in /testassets/InteropTestsGrpcWebWebsite/Tests by @dependabot[bot] in grpc/grpc-dotnet#2767 * Update the versions for pre release. by @asheshvidyut in grpc/grpc-dotnet#2768 * Update version for 2.84.x-pre1 by @asheshvidyut in grpc/grpc-dotnet#2769 * Remove pre suffix for 2.84.0 stable release by @asheshvidyut in grpc/grpc-dotnet#2770 ## New Contributors * @pavelsavara made their first contribution in grpc/grpc-dotnet#2756 * @DeagleGross made their first contribution in grpc/grpc-dotnet#2766 **Full Changelog**: grpc/grpc-dotnet@v2.83.0...v2.84.0 ## 2.84.0-pre1 ## What's Changed * Document complete release version updates by @JamesNK in grpc/grpc-dotnet#2748 * Bump axios from 1.16.0 to 1.18.1 in /testassets/InteropTestsGrpcWebWebsite/Tests by @dependabot[bot] in grpc/grpc-dotnet#2745 * Bump fast-uri from 3.1.2 to 3.1.4 in /examples/Browser/Server/wwwroot by @dependabot[bot] in grpc/grpc-dotnet#2749 * Avoid blocking SemaphoreSlim.Wait(0) on single-threaded browser WASM by @pavelsavara in grpc/grpc-dotnet#2756 * Update package dependencies and examples by @JamesNK in grpc/grpc-dotnet#2759 * Bump fast-uri from 3.1.4 to 3.1.5 in /examples/Browser/Server/wwwroot by @dependabot[bot] in grpc/grpc-dotnet#2754 * Bump brace-expansion in /testassets/InteropTestsGrpcWebWebsite/Tests by @dependabot[bot] in grpc/grpc-dotnet#2755 * Bump ip-address from 10.2.0 to 10.5.0 in /testassets/InteropTestsGrpcWebWebsite/Tests by @dependabot[bot] in grpc/grpc-dotnet#2757 * Stabilize unobserved exception retry test by @JamesNK in grpc/grpc-dotnet#2758 * Fix corrupted bytes sent after GOAWAY by @DeagleGross in grpc/grpc-dotnet#2766 * Bump fast-uri from 3.1.5 to 3.1.7 in /examples/Browser/Server/wwwroot by @dependabot[bot] in grpc/grpc-dotnet#2761 * Bump js-yaml in /testassets/InteropTestsGrpcWebWebsite/Tests by @dependabot[bot] in grpc/grpc-dotnet#2765 * Bump joi from 17.13.4 to 17.13.7 in /testassets/InteropTestsGrpcWebWebsite/Tests by @dependabot[bot] in grpc/grpc-dotnet#2764 * Bump baseline-browser-mapping from 2.9.19 to 2.11.21 in /examples/Browser/Server/wwwroot by @dependabot[bot] in grpc/grpc-dotnet#2763 * Bump browserslist from 4.25.1 to 4.28.8 in /testassets/InteropTestsGrpcWebWebsite/Tests by @dependabot[bot] in grpc/grpc-dotnet#2762 * Bump @babel/core from 7.28.0 to 7.29.7 in /testassets/InteropTestsGrpcWebWebsite/Tests by @dependabot[bot] in grpc/grpc-dotnet#2767 * Update the versions for pre release. by @asheshvidyut in grpc/grpc-dotnet#2768 * Update version for 2.84.x-pre1 by @asheshvidyut in grpc/grpc-dotnet#2769 ## New Contributors * @pavelsavara made their first contribution in grpc/grpc-dotnet#2756 * @DeagleGross made their first contribution in grpc/grpc-dotnet#2766 **Full Changelog**: grpc/grpc-dotnet@v2.83.0...v2.84.0-pre1 Commits viewable in [compare view](grpc/grpc-dotnet@v2.83.0...v2.84.0). </details> Updated [Microsoft.EntityFrameworkCore.Design](https://github.com/dotnet/dotnet) from 10.0.11 to 10.0.12. <details> <summary>Release notes</summary> _Sourced from [Microsoft.EntityFrameworkCore.Design's releases](https://github.com/dotnet/dotnet/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/dotnet/dotnet/commits). </details> Updated [Microsoft.EntityFrameworkCore.SqlServer](https://github.com/dotnet/dotnet) from 10.0.11 to 10.0.12. <details> <summary>Release notes</summary> _Sourced from [Microsoft.EntityFrameworkCore.SqlServer's releases](https://github.com/dotnet/dotnet/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/dotnet/dotnet/commits). </details> Updated [Microsoft.EntityFrameworkCore.Tools](https://github.com/dotnet/dotnet) from 10.0.11 to 10.0.12. <details> <summary>Release notes</summary> _Sourced from [Microsoft.EntityFrameworkCore.Tools's releases](https://github.com/dotnet/dotnet/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/dotnet/dotnet/commits). </details> Updated [OpenTelemetry.Exporter.OpenTelemetryProtocol](https://github.com/open-telemetry/opentelemetry-dotnet) from 1.19.0 to 1.19.1. <details> <summary>Release notes</summary> _Sourced from [OpenTelemetry.Exporter.OpenTelemetryProtocol's releases](https://github.com/open-telemetry/opentelemetry-dotnet/releases)._ ## 1.19.1 For highlights and announcements pertaining to this release see: [Release Notes > 1.19.1](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/RELEASENOTES.md#1191). The following changes are from the previous release [1.19.0](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.19.0). * NuGet: [OpenTelemetry v1.19.1](https://www.nuget.org/packages/OpenTelemetry/1.19.1) * Fixed `NotSupportedException` thrown when building a `TracerProvider` or `MeterProvider` with a large number of wildcard source/meter patterns on `net8.0`, and a related `OutOfMemoryException` that could occur when many such providers were built over the lifetime of a process. ([#7788](open-telemetry/opentelemetry-dotnet#7788)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1/src/OpenTelemetry/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Api v1.19.1](https://www.nuget.org/packages/OpenTelemetry.Api/1.19.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1/src/OpenTelemetry.Api/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Api.ProviderBuilderExtensions v1.19.1](https://www.nuget.org/packages/OpenTelemetry.Api.ProviderBuilderExtensions/1.19.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1/src/OpenTelemetry.Api.ProviderBuilderExtensions/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.Console v1.19.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Console/1.19.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1/src/OpenTelemetry.Exporter.Console/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.InMemory v1.19.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.InMemory/1.19.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1/src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.OpenTelemetryProtocol v1.19.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.OpenTelemetryProtocol/1.19.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.Zipkin v1.19.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Zipkin/1.19.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1/src/OpenTelemetry.Exporter.Zipkin/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Extensions.Hosting v1.19.1](https://www.nuget.org/packages/OpenTelemetry.Extensions.Hosting/1.19.1) No notable changes. ... (truncated) ## 1.19.1-rc.1 The following changes are from the previous release [1.19.0](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.19.0). * NuGet: [OpenTelemetry v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry/1.19.1-rc.1) * Fixed `NotSupportedException` thrown when building a `TracerProvider` or `MeterProvider` with a large number of wildcard source/meter patterns on `net8.0`, and a related `OutOfMemoryException` that could occur when many such providers were built over the lifetime of a process. ([#7788](open-telemetry/opentelemetry-dotnet#7788)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Api v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry.Api/1.19.1-rc.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry.Api/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Api.ProviderBuilderExtensions v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry.Api.ProviderBuilderExtensions/1.19.1-rc.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry.Api.ProviderBuilderExtensions/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.Console v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Console/1.19.1-rc.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry.Exporter.Console/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.InMemory v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.InMemory/1.19.1-rc.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.OpenTelemetryProtocol v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.OpenTelemetryProtocol/1.19.1-rc.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.Zipkin v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Zipkin/1.19.1-rc.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry.Exporter.Zipkin/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Extensions.Hosting v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry.Extensions.Hosting/1.19.1-rc.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry.Extensions.Hosting/CHANGELOG.md) for details. ... (truncated) ## 1.19.1-beta.1 The following changes are from the previous release [1.19.0-beta.1](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/coreunstable-1.19.0-beta.1). * NuGet: [OpenTelemetry.Exporter.Prometheus.AspNetCore v1.19.1-beta.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Prometheus.AspNetCore/1.19.1-beta.1) * Updated OpenTelemetry core component version(s) to `1.19.1`. ([#7796](open-telemetry/opentelemetry-dotnet#7796)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/coreunstable-1.19.1-beta.1/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.Prometheus.HttpListener v1.19.1-beta.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Prometheus.HttpListener/1.19.1-beta.1) * Updated OpenTelemetry core component version(s) to `1.19.1`. ([#7796](open-telemetry/opentelemetry-dotnet#7796)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/coreunstable-1.19.1-beta.1/src/OpenTelemetry.Exporter.Prometheus.HttpListener/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Shims.OpenTracing v1.19.1-beta.1](https://www.nuget.org/packages/OpenTelemetry.Shims.OpenTracing/1.19.1-beta.1) * Updated OpenTelemetry core component version(s) to `1.19.1`. ([#7796](open-telemetry/opentelemetry-dotnet#7796)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/coreunstable-1.19.1-beta.1/src/OpenTelemetry.Shims.OpenTracing/CHANGELOG.md) for details. Commits viewable in [compare view](open-telemetry/opentelemetry-dotnet@core-1.19.0...core-1.19.1). </details> Updated [OpenTelemetry.Extensions.Hosting](https://github.com/open-telemetry/opentelemetry-dotnet) from 1.19.0 to 1.19.1. <details> <summary>Release notes</summary> _Sourced from [OpenTelemetry.Extensions.Hosting's releases](https://github.com/open-telemetry/opentelemetry-dotnet/releases)._ ## 1.19.1 For highlights and announcements pertaining to this release see: [Release Notes > 1.19.1](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/RELEASENOTES.md#1191). The following changes are from the previous release [1.19.0](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.19.0). * NuGet: [OpenTelemetry v1.19.1](https://www.nuget.org/packages/OpenTelemetry/1.19.1) * Fixed `NotSupportedException` thrown when building a `TracerProvider` or `MeterProvider` with a large number of wildcard source/meter patterns on `net8.0`, and a related `OutOfMemoryException` that could occur when many such providers were built over the lifetime of a process. ([#7788](open-telemetry/opentelemetry-dotnet#7788)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1/src/OpenTelemetry/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Api v1.19.1](https://www.nuget.org/packages/OpenTelemetry.Api/1.19.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1/src/OpenTelemetry.Api/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Api.ProviderBuilderExtensions v1.19.1](https://www.nuget.org/packages/OpenTelemetry.Api.ProviderBuilderExtensions/1.19.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1/src/OpenTelemetry.Api.ProviderBuilderExtensions/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.Console v1.19.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Console/1.19.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1/src/OpenTelemetry.Exporter.Console/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.InMemory v1.19.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.InMemory/1.19.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1/src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.OpenTelemetryProtocol v1.19.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.OpenTelemetryProtocol/1.19.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.Zipkin v1.19.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Zipkin/1.19.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1/src/OpenTelemetry.Exporter.Zipkin/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Extensions.Hosting v1.19.1](https://www.nuget.org/packages/OpenTelemetry.Extensions.Hosting/1.19.1) No notable changes. ... (truncated) ## 1.19.1-rc.1 The following changes are from the previous release [1.19.0](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.19.0). * NuGet: [OpenTelemetry v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry/1.19.1-rc.1) * Fixed `NotSupportedException` thrown when building a `TracerProvider` or `MeterProvider` with a large number of wildcard source/meter patterns on `net8.0`, and a related `OutOfMemoryException` that could occur when many such providers were built over the lifetime of a process. ([#7788](open-telemetry/opentelemetry-dotnet#7788)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Api v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry.Api/1.19.1-rc.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry.Api/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Api.ProviderBuilderExtensions v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry.Api.ProviderBuilderExtensions/1.19.1-rc.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry.Api.ProviderBuilderExtensions/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.Console v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Console/1.19.1-rc.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry.Exporter.Console/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.InMemory v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.InMemory/1.19.1-rc.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.OpenTelemetryProtocol v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.OpenTelemetryProtocol/1.19.1-rc.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.Zipkin v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Zipkin/1.19.1-rc.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry.Exporter.Zipkin/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Extensions.Hosting v1.19.1-rc.1](https://www.nuget.org/packages/OpenTelemetry.Extensions.Hosting/1.19.1-rc.1) No notable changes. See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/core-1.19.1-rc.1/src/OpenTelemetry.Extensions.Hosting/CHANGELOG.md) for details. ... (truncated) ## 1.19.1-beta.1 The following changes are from the previous release [1.19.0-beta.1](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/coreunstable-1.19.0-beta.1). * NuGet: [OpenTelemetry.Exporter.Prometheus.AspNetCore v1.19.1-beta.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Prometheus.AspNetCore/1.19.1-beta.1) * Updated OpenTelemetry core component version(s) to `1.19.1`. ([#7796](open-telemetry/opentelemetry-dotnet#7796)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/coreunstable-1.19.1-beta.1/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.Prometheus.HttpListener v1.19.1-beta.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Prometheus.HttpListener/1.19.1-beta.1) * Updated OpenTelemetry core component version(s) to `1.19.1`. ([#7796](open-telemetry/opentelemetry-dotnet#7796)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/coreunstable-1.19.1-beta.1/src/OpenTelemetry.Exporter.Prometheus.HttpListener/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Shims.OpenTracing v1.19.1-beta.1](https://www.nuget.org/packages/OpenTelemetry.Shims.OpenTracing/1.19.1-beta.1) * Updated OpenTelemetry core component version(s) to `1.19.1`. ([#7796](open-telemetry/opentelemetry-dotnet#7796)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/coreunstable-1.19.1-beta.1/src/OpenTelemetry.Shims.OpenTracing/CHANGELOG.md) for details. Commits viewable in [compare view](open-telemetry/opentelemetry-dotnet@core-1.19.0...core-1.19.1). </details> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
GrpcCallcached a singleGrpcCallSerializationContextinstance for the lifetime of the call. When the HTTP/2 transport replays a request onto a new connection (e.g. after receiving GOAWAY) while the original write is still in flight, both attempts can concurrently reinitialize and mutate the same cached context/buffer, corrupting the serialized message bytes on the wire. Current PR replaces the cached context with a newGrpcCallSerializationContextinstance so every serialization attempt gets its own instance, eliminating the shared mutable state.While I understand y-meh's comment:
I did not find a nice way to reuse same serialization contexts across different
GrpcCalls. The only way I could think of it is to create a pool, which will make us borrow from it instead of making a new allocation, but comes with more complications (like cleaning up pool by timeouts, etc). CurrentlyGrpcCallSerializationContextholdsbyte[] bufferbut it is ArrayPool-rented, so the cost of allocation is practically not costly.Fixes #2760