Skip to content
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

pkg/util/allstacks: wrap the stack traces with debugutil.SafeStack #137001

Merged

Conversation

arjunmahishi
Copy link
Contributor

The functions Get() and GetWithBuf() internally call runtime.Stack() to fetch the calling go routine's stack trace.

This commit changes the return type of both the function from []byte to debugutil.SafeStack (introduced in #136288). This will ensure that the stack traces generated using these function are not redacted.

Part of: CRDB-15292
Epic: CRDB-37533
Release note: None

Copy link

blathers-crl bot commented Dec 9, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

The functions Get() and GetWithBuf() internally call runtime.Stack() to
fetch the calling go routine's stack trace.

This commit changes the return type of both the function from []byte to
debugutil.SafeStack (introduced in cockroachdb#136288). This will ensure that the
stack traces generated using these function are not redacted.

Part of: CRDB-15292
Epic: CRDB-37533
Release note: None
@arjunmahishi arjunmahishi force-pushed the unredact-stack-traces-followup branch from 101b9ec to f3c0952 Compare December 9, 2024 10:03
@arjunmahishi
Copy link
Contributor Author

pkg/util/debugutil/debugutil.go line 60 at r1 (raw file):

// and only when necessary.
func Stack() SafeStack {
	return SafeStack(debug.Stack())

We don't have to do a an explicit conversion since the return type is already SafeStack. It's ever so slightly faster when we don't do the conversion.

Copy link
Contributor

@aa-joshi aa-joshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @dhartunian)

@arjunmahishi
Copy link
Contributor Author

bors r=aa-joshi

@craig craig bot merged commit 3e1c78a into cockroachdb:master Dec 11, 2024
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants