Repository navigation
fix(proxy): log pprof serve errors instead of clean shutdowns - #214
Open
a-palamarchuk wants to merge 1 commit into
Open
a-palamarchuk wants to merge 1 commit into
a-palamarchuk wants to merge 1 commit into
Conversation
The pprof goroutine logged an error only when Serve returned http.ErrServerClosed, which is the expected result of Stop. So every clean shutdown with --pprof logged "pprof server error: http: Server closed", and real serve failures were dropped silently. Invert the check and move the goroutine body into servePprof so a test can cover both cases. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Problem
In
Server.Start, the pprof goroutine logged an error only whenServereturnedhttp.ErrServerClosed:http.ErrServerClosedis the expected result ofStop(). So every clean exit with--pproflogs an error, and real serve failures are dropped silently.Change
!errors.Is(err, http.ErrServerClosed).servePprof(ln)so a test can call it synchronously.TestServePprofLogsOnlyUnexpectedErrors, which covers both a clean shutdown and a real serve failure on a closed listener. Both subtests fail onmainand pass with this change.Testing
Before (main) and after (this branch), using
boundary --jail-type=landjail --pprof --pprof-port 6061 --disable-audit-logs --log-level info -- sh -c 'sleep 0.3':make unit-test: pass. Onmainwithout test(proxy): serve proxy test upstreams locally #213,TestProxyServerImplicitCONNECTandTestMultipleRequestsOverExplicitCONNECTfail becausedev.coder.comnow redirects; that PR fixes them.make fmt-check: passes.AI disclosure
I used Claude Code to find the bug and draft the fix. I reviewed the diff and ran the checks above myself.