streamnative / pulsar-client-go

Apache Pulsar Go Client Library
https://pulsar.apache.org/
Apache License 2.0
1 stars 2 forks source link

ISSUE-664: ReconsumeLater cause panic #241

Open sijie opened 2 years ago

sijie commented 2 years ago

Original Issue: apache/pulsar-client-go#664


Expected behavior

should be ReconsumeLater

Actual behavior

Panic when call ReconsumeLater

With version 0.6.0 https://github.com/apache/pulsar-client-go/blob/fe3b7c4e445b3de42974ca692574229ad9099a45/pulsar/consumer_impl.go?_pjax=%23js-repo-pjax-container%2C%20div%5Bitemtype%3D%22http%3A%2F%2Fschema.org%2FSoftwareSourceCode%22%5D%20main%2C%20%5Bdata-pjax-container%5D#L481

same panic for 0.7

github.com/apache/pulsar-client-go@v0.7.0-candidate-1.0.20211108044248-fe3b7c4e445b/pulsar/consumer_impl.go:481 +0x6ca

Steps to reproduce

    client, err := pulsar.NewClient(pulsar.ClientOptions{
        URL: addr,
    })
    if err != nil {
        panic(err)
    }

    consumer, err := client.Subscribe(pulsar.ConsumerOptions{
        Topic:            "test",
        SubscriptionName: "xyz",
    })
    if err != nil {
        panic(err)
    }

        for {
            select {
            case cm := <-consumer.Chan():
                fmt.Println(string(cm.Payload()))
                cm.ReconsumeLater(cm.Message,time.Second)
            }
        }

System configuration

Pulsar version: 0.6.0