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

Show error stack trace if --debug is given #2789

Merged
merged 1 commit into from
Feb 5, 2021

Conversation

kolyshkin
Copy link
Contributor

We use github.com/pkg/errors to produce an error in many places.
One of its benefits is error comes with a stack trace.

Let's print that stack trace if --debug is given.

Example:

# ../runc --debug run -d ''
ERRO[0000] container id cannot be empty
DEBU[0000] container id cannot be empty
main.init
	github.com/opencontainers/runc/utils_linux.go:28
runtime.doInit
	runtime/proc.go:5652
runtime.main
	runtime/proc.go:191
runtime.goexit
	runtime/asm_amd64.s:1374

We use github.com/pkg/errors to produce an error in many places.
One of its benefits is error comes with a stack trace.

Let's print that stack trace if --debug is set.

Example:

	# ../runc --debug run -d ''
	ERRO[0000] container id cannot be empty
	DEBU[0000] container id cannot be empty
	main.init
		github.com/opencontainers/runc/utils_linux.go:28
	runtime.doInit
		runtime/proc.go:5652
	runtime.main
		runtime/proc.go:191
	runtime.goexit
		runtime/asm_amd64.s:1374

Signed-off-by: Kir Kolyshkin <[email protected]>
Copy link
Member

@cyphar cyphar left a comment

Choose a reason for hiding this comment

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

LGTM. I'm kinda surprised we weren't doing this already.

@cyphar cyphar added this to the 1.0.0-rc94 milestone Feb 5, 2021
@AkihiroSuda AkihiroSuda merged commit 072ed87 into opencontainers:master Feb 5, 2021
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