Go-SDK: exclude oversized-payload framing test from -race builds#67602
Open
jason810496 wants to merge 1 commit into
Open
Go-SDK: exclude oversized-payload framing test from -race builds#67602jason810496 wants to merge 1 commit into
jason810496 wants to merge 1 commit into
Conversation
TestWriteFrameRejectsOversizedPayload uses unsafe.Slice with a length greater than MaxFrameSize on a single-byte backing array to exercise writeFrame's size guard without actually allocating 4 GiB. Under -race, Go's checkptr instrumentation treats the resulting slice as straddling allocations and fatals the entire test binary, which currently prevents go test -race from running on the pkg/execution package at all. Move the test into its own file gated by //go:build !race so the non-race build keeps the coverage and the race build skips it. The guard under test is a single len() comparison; losing race-mode coverage on that one path is acceptable to keep the rest of the package's race tests runnable.
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.
Why
go test -race ./pkg/execution/currently fatals before any test in the package can run.TestWriteFrameRejectsOversizedPayloadconstructs a 4 GiB+ slice withunsafe.Slice(&backing, MaxFrameSize+1)to exercisewriteFrame's size guard cheaply, and the checkptr instrumentation that-raceenables treats the resulting "slice straddles allocations" as a fatal violation.The existing
strconv.IntSizeruntime skip does not help, checkptr fires insideunsafe.Sliceitself, before anyt.Skipcould run.What
TestWriteFrameRejectsOversizedPayloadout offrames_test.gointo a new fileframes_oversized_test.gocarrying//go:build !race, so the file (and theunsafe.Slicecall inside it) is excluded from the build under-race.strconvandunsafeimports fromframes_test.go.Verification
Non-race build still exercises the test.
Race build skips the test (no checkptr fatal).
Whole package now passes under
-race(previously fatal):Was generative AI tooling used to co-author this PR?