Repository navigation
Conversation
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.
What type of PR is this?
Description
messageWriter.WriteandWriteStringcurrently return(0, err)if a later buffer flush fails, even when the current call has already copied a prefix into the message buffer and an earlier frame has reached the peer. This also makesio.Copyreport zero progress for that call.Return
nn - len(p)on the buffered-loop error path, so the count reflects bytes accepted from the current argument. Bytes pending from an earlier call are not included. The returned count describes buffer acceptance; it does not guarantee that every counted byte reached the peer. Error identity, sticky failure behavior, successful writes, and the existing large-server fast path are unchanged.Add a regression matrix using actual HTTP Upgrade/Dial and TCP client/server sockets, with a deterministic write-error wrapper after the first successful write. It covers
Write,WriteString,io.Copy, primed-buffer/current-call accounting, separate peer-delivery assertions, zero progress, sticky errors, success, and the large-server fast path. Every socket has bounded deadlines and cleanup.Related Tickets & Documents
The original-source run reproduces the count error: original RED, unchanged production blob
9562ffd4978ccabea0da2f06256e1c281bcefb7f. Five existing controls passed; twelve new progress cases failed (0rather than16/13), while all fourteen boundary/control cases passed. The same regression source is used in this PR.Existing proxy-test instability is tracked separately in #982; no proxy-test change is included here.
Added/updated tests?
Run verifications and test
An isolated public-fork Ubuntu workflow explicitly checked out exact source commit
97f927d22d5982ce81101efe76adac24bf59fd78(native validation). The workflow commit differs from the source commit and is excluded from this PR.Go 1.20.14, 1.21.13, 1.22.12 and 1.27.1: all 26 new socket regressions, existing focused controls, complete
go test -v -race -coverprofile=... ./...,go vet ./...and formatting of both changed files passed. The full run has 77 passing top-level tests and 30 passing subtests; no race warnings or skips.Go 1.22: all 20 existing benchmark cases executed with
-benchtime=1x -benchmem. This is a smoke check, not a performance claim.Both changed-file Git blobs/SHA256 and actual source HEAD were verified before and after all commands, with zero tracked diff. Both writer methods have 100% statement coverage in this run.
Full original/fixed race suites were paired. Earlier attempts encountered existing proxy-test flakes, and the final Go 1.27 baseline also failed an existing proxy test while the fixed full run passed. These failures are retained; this PR does not claim to repair the proxy flake.
Whole-project Go 1.27 formatting fails on both original and fixed sources with the same 6127-byte
doc.godiff (comparison exit 0). The changed files pass gofmt.Org-guide tools were run against original and exact fixed source without suppressions: golint and govulncheck exit 0 on both. Govulncheck reports unreachable dependency advisories, so this is not a claim of no advisories. Gosec exits 1 with the same 55 diagnostics on both. Golangci-lint exits 1 on both; with diagnostic limits removed, all 124 diagnostics are identical, and none concern the new test or modified returns.
make verifyis passingmake testis passingThis repository has no Makefile or those targets. Both commands were attempted on original and fixed sources and returned exit 2; the equivalent project-native tests and quality commands are reported above. The aggregate helper workflow correctly remains FAILURE because it preserves those existing format/tool failures rather than claiming all checks green.
This change was developed with AI assistance and verified with the project's native commands.
The org-template reviewer-team request for gorilla/pull-request-reviewers was attempted, but GitHub rejected RequestReviewsByLogin because this account lacks permission. No reviewer-team assignment is claimed.