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

runtime: slice bounds out of range in issue9321 and issue9714 #16757

Closed
jonsyu1 opened this issue Aug 17, 2016 · 8 comments
Closed

runtime: slice bounds out of range in issue9321 and issue9714 #16757

jonsyu1 opened this issue Aug 17, 2016 · 8 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@jonsyu1
Copy link

jonsyu1 commented Aug 17, 2016

Version, OS, architecture:
go version go1.6.2
linux-amd64

What happened: slice bounds out of range in bytes.Buffer.grow when we call bytes.Buffer.WriteString with buffered output from exec.Command. Unfortunately, I don't have repro steps, but we have seen this a dozen times spread across different machines, so it seems that #9714 still happens in go1.6.2.

Expected: either successfully write the string to the bytes.Buffer or panic with ErrTooLarge.
Actual: panic with slide bounds out of range

panic: runtime error: slice bounds out of range

goroutine 92530 [running]:
panic(0xd3e7a0, 0xc8200120a0)
    /usr/local/go/src/runtime/panic.go:481 +0x3e6
bytes.(*Buffer).grow(0xc820166080, 0x71, 0x448207)
    /usr/local/go/src/bytes/buffer.go:112 +0x141
bytes.(*Buffer).WriteString(0xc820166080, 0xc820360080, 0x71, 0x71, 0x0, 0x0)
    /usr/local/go/src/bytes/buffer.go:143 +0x4b
.../pkg/bytestruncated.(*Buffer).WriteString(0xc820166080, 0xc820360080, 0x71, 0x71)
    /home/ubuntu/.go_workspace/src/.../pkg/bytestruncated/buffer.go:23 +0x8f
.../deployd/lifecycle.(*CmdServiceController).runCmd.func2(0xc820360080, 0x71)
    /home/ubuntu/.go_workspace/src/.../deployd/lifecycle/cmdctrl.go:72 +0x34
.../pkg/bufcmd.(*bufferedCmd).process.func2()
    /home/ubuntu/.go_workspace/src/.../pkg/bufcmd/bufcmd.go:154 +0xc9
.../pkg/bufcmd.(*bufferedCmd).process(0xc82044c2a0, 0x7f83a25f7ba0, 0xc820248050, 0xc8203f97b0)
    /home/ubuntu/.go_workspace/src/.../pkg/bufcmd/bufcmd.go:163 +0x2d6
created by .../pkg/bufcmd.(*bufferedCmd).Start
    /home/ubuntu/.go_workspace/src/.../pkg/bufcmd/bufcmd.go:90 +0x17a

Sorry if this duplicate issue isn't the correct SOP: couldn't find any docs on working with FrozenDueToAge.

@bradfitz
Copy link
Contributor

Does your program have any data races?

@jonsyu1
Copy link
Author

jonsyu1 commented Aug 17, 2016

No warnings on go install -race.

@dsnet
Copy link
Member

dsnet commented Aug 17, 2016

Sorry if you did this already, but you need to run it with the race detector just build it:

go build -race main.go
./main

or

go run -race main.go

@jonsyu1
Copy link
Author

jonsyu1 commented Aug 17, 2016

Sorry, it should have been obvious that the race detector works at runtime. I have left my program running for 5 minutes with no DATA RACE warnings. Will leave it on overnight and see if anything comes up.

@dsnet dsnet added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 17, 2016
@jonsyu1
Copy link
Author

jonsyu1 commented Aug 17, 2016

Left it running for 16 hours: no data race warnings came up.

We're currently working around this by deferring a recover in all goroutines that buffer.

@bradfitz
Copy link
Contributor

Is the code available?

@jonsyu1
Copy link
Author

jonsyu1 commented Aug 17, 2016

Sorry @bradfitz, the code is private. I may take some time to reproduce this issue without internal code in the future, but not anytime soon.

I know this is insufficient information to debug at this point, but I wanted to make sure you all know that this can happen in go1.6.2, since #9714 implied a belief that this was fixed in go1.5.

@bradfitz
Copy link
Contributor

I guess we'll have to close this bug, then, since there's nothing to do.

I still strongly suspect a race due to misuse of the easy-to-misuse os/exec package.

Please file a bug again or reopen this one if you have a minimal repro with source code.

@golang golang locked and limited conversation to collaborators Aug 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants