Skip to content

panic in slicer #178

Closed
Closed

Description

@kirs

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

Activity

  1. xthexder commented on May 17, 2017

    @xthexder
    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.

  2. kirs commented on May 18, 2017

    @kirs
    Author

    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.

  3. adambair commented on Dec 12, 2019

    @adambair

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

  4. areveny commented on Jan 19, 2022

    @areveny
    Contributor

    Looking at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions