Change information
Commit message:
internal/profile: return error from gzip.Writer.Close in Profile.Write
Profile.Write defers gzip.Writer.Close without checking its return
value. Close flushes buffered data and writes the gzip footer (CRC32
checksum and size). If the flush or footer write fails, the caller
receives a nil error despite the output being truncated or corrupt.
This is called by runtime/pprof and net/http/pprof to serialize
profiles. A write error during gzip finalization (e.g., broken pipe,
full disk) produces corrupt output reported as success.
Remove the defer and call Close explicitly after Write, returning
its error. On Write failure, Close is still called to release
resources, but the Write error is returned.
Fixes #79423
Change-Id: I1d93c20158010f45c72d57caf5d5b25b72ca7511
GitHub-Last-Rev: cd79f2a4cf61f6e175207706f040f21c2c037180
GitHub-Pull-Request: golang/go#79424
Files:
- M src/internal/profile/profile.go
Change size: XS
Delta: 1 file changed, 5 insertions(+), 3 deletions(-)
Branch: refs/heads/master