Fix yproxy error messages#165
Conversation
Root Cause AnalysisIssue 1: "cat object with offset after possible error"Trace through the code:
Most likely root causes:
Misleading log: The Issue 2: "failed to upload" — Two distinct sub-casesSub-case A — In
Sub-case B — In Cascade errors ( Proposed Fixes
Diagnosis confirmation needed before implementing fixes 3, 5, 6: fixes 1, 2, 4 are straightforward; fixes 3, 5, 6 require code changes. Please confirm which issues to address in code. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
This PR updates yproxy’s S3 upload and “cat” read paths to produce clearer, more actionable errors and to adjust retry behavior—especially when decryption is enabled (where mid-stream restarts are unsafe).
Changes:
- Added credential lookup helper to fail fast when bucket credentials are missing and warn on empty keys.
- Added multipart-upload retry logic for
NoSuchUploadand fixed an error-return bug inPatchFile. - Split
ProcessCatExtendedinto decrypt vs non-decrypt paths, adding full-pipeline retries for decrypt and downgrading/disambiguating certain log severities/messages.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pkg/storage/s3storage.go | Adds credential validation and multipart upload retry handling; fixes an incorrect nil error return in PatchFile. |
| pkg/proc/yio/yrreader.go | Adjusts restart log severity/message and introduces a “no-retry” retry-reader constructor for decrypt use-cases. |
| pkg/proc/interaction.go | Refactors cat handling into decrypt/non-decrypt flows; adds broken-pipe detection and full-pipeline retry loop for decrypt. |
Comments suppressed due to low confidence (1)
pkg/proc/interaction.go:152
- Same
uint64→int64overflow risk forstartOffsetwhen callingio.CopyNin the decrypted path. ValidatestartOffsetfits intoint64before casting and return an error if it does not.
if startOffset != 0 {
if _, err := io.CopyN(io.Discard, contentReader, int64(startOffset)); err != nil {
return err
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/open-gpdb/yproxy/sessions/035ec91b-e699-4190-9305-a4dbdf19c0a3 Co-authored-by: leborchuk <63977577+leborchuk@users.noreply.github.com>
Agent-Logs-Url: https://github.com/open-gpdb/yproxy/sessions/bc2c617f-667c-4fef-a3be-ea84684a3d43 Co-authored-by: leborchuk <63977577+leborchuk@users.noreply.github.com>
Agent-Logs-Url: https://github.com/open-gpdb/yproxy/sessions/bc2c617f-667c-4fef-a3be-ea84684a3d43 Co-authored-by: leborchuk <63977577+leborchuk@users.noreply.github.com>
Agent-Logs-Url: https://github.com/open-gpdb/yproxy/sessions/bc2c617f-667c-4fef-a3be-ea84684a3d43 Co-authored-by: leborchuk <63977577+leborchuk@users.noreply.github.com>
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.Unrecognized words (28)These words are not needed and should be removedpersisntTo accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands... in a clone of the git@github.com:open-gpdb/yproxy.git repository curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/main/apply.pl' |
perl - 'https://github.com/open-gpdb/yproxy/actions/runs/25549190293/attempts/1' &&
git commit -m 'Update check-spelling metadata'OR To have the bot accept them for you, comment in the PR quoting the following line: Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionaryThis includes both expected items (238) from .github/actions/spelling/expect.txt and unrecognized words (28)
Consider adding them (in cspell:golang/dict/go.txt
cspell:node/dict/node.txt
cspell:php/dict/php.txt
cspell:python/src/python/python-lib.txt
cspell:dotnet/dict/dotnet.txt
cspell:filetypes/filetypes.txt
cspell:fullstack/dict/fullstack.txt
cspell:java/src/java.txt
cspell:python/src/python/python.txt
cspell:typescript/dict/typescript.txt
cspell:k8s/dict/k8s.txt
cspell:django/dict/django.txt
cspell:aws/aws.txt
cspell:cpp/src/stdlib-c.txt
cspell:rust/dict/rust.txt
cspell:scala/dict/scala.txt
cspell:cpp/src/stdlib-cpp.txt
cspell:npm/dict/npm.txt
cspell:r/src/r.txt
cspell:lua/dict/lua.txtTo stop checking additional dictionaries, add (in check_extra_dictionaries: ""Pattern suggestions ✂️ (9)You could add these patterns to Alternatively, if a pattern suggestion doesn't make sense for this project, add a Notices ℹ️ (2)See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.
See ℹ️ Event descriptions for more information. If the flagged items are 🤯 false positivesIf items relate to a ...
🚂 If you're seeing this message and your PR is from a branch that doesn't have check-spelling, |
This is generated code.
We see two issues in yproxy logs:
cat errorandwrite unix /tmp/yproxy.sock->@: write: broken pipeupload errorHere I generate fixes to address issues:
The summary of changes across 3 files:
pkg/storage/s3storage.go— Fixes for upload errorsFix 1: Fail loudly on missing credentials — Added
getCredentials()helper that replaces all 8 silents.credentialMap[bucket]map accesses. It returns an explicit error if the bucket has no credentials configured, and warns when keys are empty (which causes silent fallback to ambient credentials — the root cause of the 403SignatureDoesNotMatch).Fix 2: Retry on
NoSuchUpload— AddedisNoSuchUploadError()helper and a retry loop (up to 3 attempts) inPutFileToDest()that detectsNoSuchUpload(404) and restarts the entire multipart upload. This addresses the case where the S3 provider aborts the upload ID server-side.**Fix 7: Add rate limit for S3 listings, we should perform no more than 2 requests per second
Bonus: Fixed
PatchFile()return value — was returningnilon session error instead of the error.pkg/proc/yio/yrreader.go— Fixes for cat errorsFix 3: Downgraded retry log — Changed
YRestartReader.Restart()fromErrortoWarnwith a clearer message: "cat object: restarting read from offset after transient error".pkg/proc/interaction.go— Fixes for cat errors + decrypt offset bugFix 4: Broken pipe detection — In
ProcessCatExtended(),EPIPE/ErrClosedPipeerrors (client disconnected) are now logged atWarninstead ofError.