feat: Add contract test for streaming connection close on client shutdown#377
Draft
jsonbailey wants to merge 1 commit into
Draft
feat: Add contract test for streaming connection close on client shutdown#377jsonbailey wants to merge 1 commit into
jsonbailey wants to merge 1 commit into
Conversation
…down Adds a connection-lifecycle subtest to the legacy server-side streaming suite asserting the SDK closes its streaming TCP socket when the client is closed, using the request Context.Done() cancellation signal. Previously only the FDv2 directed-fallback path asserted socket closure; the legacy FDv1 path had no equivalent coverage.
c9bef55 to
9889fae
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new connection-lifecycle subtest to the legacy server-side streaming suite asserting that the SDK closes its streaming TCP socket when the client is closed.
sdktests/server_side_stream_all.go, as aconnection lifecyclesubtest underdoServerSideStreamTests(path:streaming/connection lifecycle/SDK closes streaming connection when client is closed).CapabilityFDv1Fallbackor any FDv2 capability. It uses a plain streaming config (NewSDKDataSource(...DataSourceOptionStreaming())+NewSDKClient(t, dataSource), no data-system object), which exercises the legacy FDv1 streaming data source.client.Close(), it polls the captured streaming request'sContext.Done(). Go's HTTP server cancels the incoming request Context when the client closes the underlying TCP connection. Deadlinetime.Second*3, polltime.Millisecond*20.TestServiceEntity.Close()usessync.Once, so the explicit close plus the automatic end-of-test close do not double-DELETE.Local validation
Run against two python-server-sdk versions on PORT 8001:
python-server-sdkmain): test RAN and FAILED 3/3 —SDK did not close the streaming connection after the client was closed. Socket stays ESTABLISHED past the 3s deadline (GC-only closure).No flakiness observed. The CPython refcounting spurious-pass concern did not materialize: buggy main misses the deadline by a wide, reliable margin.
Needs team discussion before merge
This assertion runs against every server-side SDK, not just Python. Any SDK that shares the same un-closed connection-pool pattern on its legacy streaming path will start failing CI once this lands. Ruby is a likely candidate. This is why the PR is opened as a draft — we should confirm which SDKs currently pass/fail and coordinate fixes (or temporary gating) before merging.
References