streadway / amqp

Go client for AMQP 0.9.1
http://godoc.org/github.com/streadway/amqp
BSD 2-Clause "Simplified" License
4.87k stars 620 forks source link

"slice bounds out of range" in Channel sendOpen #74

Closed peterbourgon closed 11 years ago

peterbourgon commented 11 years ago

I have an application that creates a single connection + channel, and serializes a ton of publishings onto it. When I publish it looks like this:

channel.Publish(
    myExchange,
    myRoutingKey,
    false, // mandatory
    false, // immediate
    amqp.Publishing{
        Headers:         amqp.Table{},
        ContentType:     "application/json",
        ContentEncoding: "",
        Body:            myBody,
        DeliveryMode:    amqp.Transient,
        Priority:        0,
        Timestamp:       time.Now(),
    },
)

Sometimes during high load I am experiencing crashes which look like this:

panic: runtime error: slice bounds out of range

goroutine 5 [running]:
github.com/streadway/amqp.(*Channel).sendOpen(0xc20013d000, 0xc2001a9700, 0xc201141d80, 0x0, 0x0, ...)
    /srv/mything/src/github.com/streadway/amqp/channel.go:237 +0x48a
github.com/streadway/amqp.(*Channel).Publish(0xc20013d000, 0x705950, 0xa, 0xc201234a20, 0x21, ...)
    /srv/mything/src/github.com/streadway/amqp/channel.go:1206 +0x22e
main.(*publisher).loop(0xc2000d0810, 0x7fffd4ae4655, 0x4, 0x7fffd4ae4674, 0x21, ...)
    /srv/mything/src/github.com/myplace/mything/publisher.go:106 +0x5ba
created by main.newPublisher
    /srv/mything/src/github.com/myplace/mything/publisher.go:36 +0xaa

Please let me know if that's not enough to go on -- with some effort I may be able to build a minimal test case.

streadway commented 11 years ago

Running a test that looks like:

        base := make([]byte, 1e5)
        for i := 0; i < len(base); i++ {
            ch.Publish("", queue, false, false, Publishing{Body: base[0:i]})
        }

I am unable to reproduce a panic at https://github.com/streadway/amqp/blob/9515743a136dbef5e14191dee1a02337ff337e97/channel.go#L237

streadway commented 11 years ago

@peterbourgon have you seen this error again?

peterbourgon commented 11 years ago

Alas, no. I'm setting up another high-load scenario early next week. If it happens again I will try to produce a better test case.