-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store the health check subscriber name to improve error message #17863
base: main
Are you sure you want to change the base?
Store the health check subscriber name to improve error message #17863
Conversation
Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Signed-off-by: Manan Gupta <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17863 +/- ##
==========================================
- Coverage 67.46% 67.44% -0.02%
==========================================
Files 1593 1594 +1
Lines 258902 259070 +168
==========================================
+ Hits 174658 174739 +81
- Misses 84244 84331 +87 ☔ View full report in Codecov by Sentry. |
var printStack = sync.OnceFunc(func() { | ||
buf := make([]byte, 10240) // Allocate buffer large enough | ||
n := runtime.Stack(buf, true) | ||
fmt.Printf("All Goroutines Stack Trace:\n%s\n", buf[:n]) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this happen only for debugging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we want to merge this, so that if we exhaust the pool in production we have the stack trace in the logs. This is why its behind a sync.Once call so that we print that only once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please help me understand why it is needed to print all go routines stack trace?
What information will use be used from it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can see why the subscriber is blocked and not processing the updates, because we'll be able to see their stack trace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is the reason, we can use the pprof to output the logs with
pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
runtime.Stack(buf, true) with true
could do a stop the world to inspect all goroutines
…ealthcheck Signed-off-by: Manan Gupta <[email protected]>
Description
This PR changes the health check to also keep track of the subscriber name so that the information message printed when we drop some healthcheck updates due to a full buffer are more informative. We also print out the stack trace once when we drop the update.
Related Issue(s)
Checklist
Deployment Notes