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

"panic: runtime error: index out of range" when Goat attempts to mounts a volume #47

Closed
frittentheke opened this issue Feb 22, 2019 · 5 comments

Comments

@frittentheke
Copy link

First of all @sevagh thanks for this nice little tool of yours!

After hundreds of successful attachments, Goat threw this error today:

systemd[1]: Starting GOAT: EC2-EBS attach utility...
attach-ebs[866]: time="2019-02-22T10:56:37Z" level=info msg="Running goat for ebs"
attach-ebs[866]: time="2019-02-22T10:56:37Z" level=info msg="WELCOME TO GOAT"
attach-ebs[866]: time="2019-02-22T10:56:37Z" level=info msg="1: COLLECTING EC2 INFO"
attach-ebs[866]: time="2019-02-22T10:56:37Z" level=info msg="Establishing metadata client"
attach-ebs[866]: time="2019-02-22T10:56:37Z" level=info msg="Retrieved metadata successfully" instance_id=i-0772edcdbced03ed7
attach-ebs[866]: time="2019-02-22T10:56:37Z" level=info msg="Using metadata to initialize EC2 SDK client" az=eu-central-1b instance_id=i-0772edcdbced03ed7 region=eu-cent>
attach-ebs[866]: time="2019-02-22T10:56:37Z" level=info msg="2: COLLECTING EBS INFO"
attach-ebs[866]: time="2019-02-22T10:56:37Z" level=info msg="Searching for EBS volumes"
attach-ebs[866]: time="2019-02-22T10:56:37Z" level=info msg="Classifying EBS volumes based on tags"
attach-ebs[866]: time="2019-02-22T10:56:37Z" level=info msg="3: ATTACHING EBS VOLS"
attach-ebs[866]: time="2019-02-22T10:56:37Z" level=info msg="4: MOUNTING ATTACHED VOLS"
attach-ebs[866]: panic: runtime error: index out of range
attach-ebs[866]: goroutine 1 [running]:
attach-ebs[866]: main.prepAndMountDrives(0xc00038c530, 0xd, 0xab2650, 0x0, 0x0)
attach-ebs[866]:         /go/src/github.com/sevagh/goat/ebs.go:43 +0x137a
attach-ebs[866]: main.GoatEbs(0x7d2800, 0x7ce218, 0x7)
attach-ebs[866]:         /go/src/github.com/sevagh/goat/ebs.go:36 +0x256
attach-ebs[866]: main.main()
attach-ebs[866]:         /go/src/github.com/sevagh/goat/main.go:66 +0x4c3
@sevagh
Copy link
Owner

sevagh commented Feb 22, 2019

Glad this tool has helped you.

After 2: COLLECTING EBS INFO, it looks like maybe it didn't successfully store those EBS volumes in the struct.

I would expect a few logs such as https://github.com/sevagh/goat/blob/master/attach.go#L23 to appear between the 3: ATTACHING EBS VOLS and 4: MOUNTING ATTACHED VOLS step but those lines are all blank.

Has anything changed since your successful runs? An upgraded version of goat, or some AWS change that might affect permissions? Missing tags?

Either way, the superficial cause of this error is https://github.com/sevagh/goat/blob/master/ebs.go#L43

Accessing vols[0] when I fail to check whether len(vols) > 0 for all vols - in fact I check the length of the parent map which contains volName: []vols{} entries, but not the nested vols lists: https://github.com/sevagh/goat/blob/master/ebs.go#L30

@sevagh sevagh closed this as completed in 3a5987e Mar 10, 2019
@sevagh sevagh reopened this Mar 10, 2019
@sevagh
Copy link
Owner

sevagh commented Mar 10, 2019

I just cut a new release, 1.0.2, which checks for this condition and logs it (rather than panicking). Have you been able to reproduce this? Would you be willing to test 1.0.2?

https://github.com/sevagh/goat/blob/master/ebs.go#L170

https://github.com/sevagh/goat/releases/tag/1.0.2

@frittentheke
Copy link
Author

@sevagh urgh, I am sorry, I completely missed your initial response to my issue :-(
I certainly will try your 1.0.2 release to see if that does not produce those panics anymore.

@frittentheke
Copy link
Author

@sevagh so far so good. You fixes seem to have done the trick.

@sevagh
Copy link
Owner

sevagh commented Mar 31, 2019

Good to hear - feel free to reopen this in case anything happens.

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

No branches or pull requests

2 participants