Skip to content

Commit c2043a9

Browse files
committed
Clean up benchmarks, fix PipeReader race, consolidate tests
- Remove benchmarks/throughput-benchmark (replaced by BenchmarkDotNet suite) - Remove benchmarks/CROSS_SDK_BENCHMARK_SPEC.md and benchmark-runner.sh - Move integration-test.sh to .github/scripts/ - Fix PipeReader cleanup race: await incomingTask BEFORE reader.Complete() - Simplify InvocationHandler exception catch to OperationCanceledException - Fix discovery.proto: add V3/V4 protocol version descriptions - Fix comment: v4 adds lambda compression, not retry_policy - Fix ReplayRun benchmark to measure StartAsync replay correctly - Remove unnecessary Roslyn dependencies from benchmarks project - Consolidate InterfaceConformanceTests to Theory+InlineData - Consolidate MockContextFeatureTests to Theory+InlineData - Remove redundant HandlerAttributeBase tests (covered by property tests)
1 parent 9100686 commit c2043a9

File tree

13 files changed

+53
-566
lines changed

13 files changed

+53
-566
lines changed

benchmarks/CROSS_SDK_BENCHMARK_SPEC.md

Lines changed: 0 additions & 49 deletions
This file was deleted.

benchmarks/benchmark-runner.sh

Lines changed: 0 additions & 95 deletions
This file was deleted.

benchmarks/throughput-benchmark/CounterObject.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

benchmarks/throughput-benchmark/Program.cs

Lines changed: 0 additions & 146 deletions
This file was deleted.

benchmarks/throughput-benchmark/ThroughputBenchmark.csproj

Lines changed: 0 additions & 14 deletions
This file was deleted.

proto/dev/restate/service/discovery.proto

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@ enum ServiceDiscoveryProtocolVersion {
2121
V1 = 1;
2222
// add custom metadata and documentation for services/handlers
2323
V2 = 2;
24+
// add options for private service, journal retention, idempotency retention,
25+
// workflow completion retention, inactivity timeout, abort timeout, enable lazy state
26+
V3 = 3;
27+
// add lambda compression
28+
V4 = 4;
2429
}

src/Restate.Sdk/Hosting/RestateEndpointRouteBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static class RestateEndpointRouteBuilderExtensions
2020
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "0.0.0"}";
2121

2222
// Supported manifest versions, highest priority first.
23-
// v4 adds retry_policy fields we don't support yet, so we cap at v3.
23+
// v4 adds lambda compression fields we don't support yet, so we cap at v3.
2424
private static readonly string[] SupportedContentTypes =
2525
[
2626
"application/vnd.restate.endpointmanifest.v3+json",

src/Restate.Sdk/Internal/InvocationHandler.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public async Task HandleAsync(
5555
var context = CreateContext(sm, service.Type, handler.IsShared, logger, handlerToken);
5656

5757
object? input = null;
58-
if (!startInfo.Input.IsEmpty && handler.InputDeserializer is not null)
58+
if (handler.InputDeserializer is not null)
5959
input = handler.InputDeserializer(new ReadOnlySequence<byte>(startInfo.Input));
6060

6161
var serviceInstance = service.Factory(serviceProvider);
@@ -102,21 +102,21 @@ public async Task HandleAsync(
102102
// the remaining cleanup from executing AND propagate an exception to Kestrel.
103103
try { writer.Complete(); } catch { /* already completed or broken */ }
104104

105+
// Cancel and await the incoming reader task BEFORE completing the reader.
106+
// This avoids a "Concurrent reads or writes are not supported" race between
107+
// PipeReader.Complete() and ProcessIncomingMessagesAsync's pending ReadAsync().
105108
try { await incomingCts.CancelAsync().ConfigureAwait(false); } catch { /* ignore */ }
106-
try { reader.Complete(); } catch { /* already completed or broken */ }
107-
108-
// Observe the incoming task to prevent silent exception swallowing.
109-
// Expected: OperationCanceledException (cancellation) or InvalidOperationException
110-
// (reader.Complete() interrupted a pending read).
111109
if (incomingTask is not null)
112110
try
113111
{
114112
await incomingTask.ConfigureAwait(false);
115113
}
116-
catch (Exception ex) when (ex is OperationCanceledException or InvalidOperationException)
114+
catch (OperationCanceledException ex)
117115
{
118116
Log.IncomingReaderStopped(logger, ex, sm.InvocationId);
119117
}
118+
119+
try { reader.Complete(); } catch { /* already completed or broken */ }
120120
}
121121
}
122122

0 commit comments

Comments
 (0)