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 in slicer #178

Closed
kirs opened this issue May 17, 2017 · 4 comments · Fixed by #359
Closed

panic in slicer #178

kirs opened this issue May 17, 2017 · 4 comments · Fixed by #359

Comments

@kirs
Copy link

kirs commented May 17, 2017

Running on 2.1.1 with a slicer toxic:

~/P/shopify (master|✚1…) $ /Users/kir/Downloads/toxiproxy-server-darwin-amd64
INFO[0000] API HTTP server starting                      host=localhost port=8474 version=2.1.1
INFO[0053] Started proxy                                 name=dumb proxy=127.0.0.1:8182 upstream=localhost:8181
INFO[0177] Accepted client                               client=127.0.0.1:62635 name=dumb proxy=127.0.0.1:8182 upstream=localhost:8181
WARN[0177] Source terminated                             bytes=655582 err=read tcp 127.0.0.1:8182->127.0.0.1:62635: use of closed network connection name=dumb
INFO[0179] Accepted client                               client=127.0.0.1:62671 name=dumb proxy=127.0.0.1:8182 upstream=localhost:8181
WARN[0179] Source terminated                             bytes=655582 err=read tcp 127.0.0.1:8182->127.0.0.1:62671: use of closed network connection name=dumb
INFO[0184] Accepted client                               client=127.0.0.1:62739 name=dumb proxy=127.0.0.1:8182 upstream=localhost:8181
WARN[0184] Source terminated                             bytes=655582 err=read tcp 127.0.0.1:8182->127.0.0.1:62739: use of closed network connection name=dumb
INFO[0238] Accepted client                               client=127.0.0.1:63609 name=dumb proxy=127.0.0.1:8182 upstream=localhost:8181
WARN[0238] Source terminated                             bytes=655582 err=read tcp 127.0.0.1:8182->127.0.0.1:63609: use of closed network connection name=dumb
INFO[0271] Accepted client                               client=127.0.0.1:64135 name=dumb proxy=127.0.0.1:8182 upstream=localhost:8181
panic: invalid argument to Intn

goroutine 49 [running]:
panic(0x261fa0, 0xc420162050)
        /usr/local/Cellar/go/1.7.1/libexec/src/runtime/panic.go:500 +0x1a1
math/rand.(*Rand).Intn(0xc42008a080, 0x0, 0x2)
        /usr/local/Cellar/go/1.7.1/libexec/src/math/rand/rand.go:116 +0xd0
math/rand.Intn(0x0, 0x0)
        /usr/local/Cellar/go/1.7.1/libexec/src/math/rand/rand.go:247 +0x37
github.com/Shopify/toxiproxy/toxics.(*SlicerToxic).chunk(0xc4200eeb40, 0x0, 0x97, 0x1, 0x0, 0x0)
        /Users/jpittis/Code/go/src/github.com/Shopify/toxiproxy/toxics/slicer.go:42 +0xcc
github.com/Shopify/toxiproxy/toxics.(*SlicerToxic).Pipe(0xc4200eeb40, 0xc420180640)
        /Users/jpittis/Code/go/src/github.com/Shopify/toxiproxy/toxics/slicer.go:60 +0x139
github.com/Shopify/toxiproxy/toxics.(*ToxicStub).Run(0xc420180640, 0xc420074360)
        /Users/jpittis/Code/go/src/github.com/Shopify/toxiproxy/toxics/toxic.go:82 +0xb5
created by github.com/Shopify/toxiproxy.(*ToxicLink).Start
        /Users/jpittis/Code/go/src/github.com/Shopify/toxiproxy/link.go:73 +0x143

cc @jpittis

@xthexder
Copy link
Contributor

It looks like this is due to size_variation not being set, and defaulting to 0.
A variation of 0 should definitely be supported, so that will need to be fixed. A workaround for now would be to set the variation to >= 1.

@kirs
Copy link
Author

kirs commented May 18, 2017

Thanks for looking into it. I didn't set size_variation when I added the toxic because I assumed it would use a default value. The help didn't mention that value for size_variation is required.

@adambair
Copy link

Still an issue, ran into this today on the latest version published to dockerhub.

@areveny
Copy link
Contributor

areveny commented Jan 19, 2022

Looking at this.

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 a pull request may close this issue.

4 participants