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

check in stderrFrame is nil before logging stderrFrame.Data #17815

Merged
merged 4 commits into from
Jul 24, 2023

Conversation

kmulvey
Copy link
Contributor

@kmulvey kmulvey commented Jul 6, 2023

Prevent panic if stderrFrame is nil

debug logging:

logUI: &{reader:0xc000014010 writer:0xc000014018 errorWriter:0xc000014020 underlyingUI:0xc000a26750 isColor:true outputColor:{Code:0 Bold:false} infoColor:{Code:92 Bold:false} errorColor:{Code:91 Bold:false} warnColor:{Code:93 Bold:false}} 
stderrFrame: <nil> 



panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x1fbf565]

goroutine 1 [running]:
github.com/hashicorp/nomad/command.(*AllocLogsCommand).tailMultipleFiles(0xc00040d7a0, 0xc000a2ae70, 0x24?)
	/home/kmulvey/src/go/src/github.com/hashicorp/nomad/command/alloc_logs.go:403 +0x645
github.com/hashicorp/nomad/command.(*AllocLogsCommand).Run(0xc00040d7a0, {0xc0000520c0, 0x3, 0x3})
	/home/kmulvey/src/go/src/github.com/hashicorp/nomad/command/alloc_logs.go:233 +0x967
github.com/mitchellh/cli.(*CLI).Run(0xc000a07cc0)
	/home/kmulvey/src/go/pkg/mod/github.com/mitchellh/[email protected]/cli.go:262 +0x5f8
main.Run({0xc0000520b0, 0x4, 0x4})
	/home/kmulvey/src/go/src/github.com/hashicorp/nomad/main.go:107 +0x28a
main.main()
	/home/kmulvey/src/go/src/github.com/hashicorp/nomad/main.go:77 +0x4e

@hashicorp-cla
Copy link

hashicorp-cla commented Jul 6, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@jrasell jrasell left a comment

Choose a reason for hiding this comment

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

LGTM and thanks @kmulvey! Would you mind adding a changelog entry; this can be setup via the make cl command within the Nomad repository root.

.changelog/17815.txt Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.5.x backport to 1.5.x release line backport/1.6.x backport to 1.6.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants