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 when consumer stops #1583

Closed
kimtree opened this issue Jan 21, 2020 · 2 comments
Closed

Panic when consumer stops #1583

kimtree opened this issue Jan 21, 2020 · 2 comments

Comments

@kimtree
Copy link

kimtree commented Jan 21, 2020

Versions

Please specify real version numbers or git SHAs, not just "Latest" since that changes fairly regularly.

Sarama Kafka Go
v1.24.1 v1.1.1 v1.13.1
Configuration

What configuration values are you using for Sarama and Kafka?

config.Version = sarama.V1_1_1_0
config.Consumer.MaxProcessingTime = 200 * time.Millisecond
config.Consumer.Return.Errors = true
Logs

When filing an issue please provide logs from Sarama and Kafka if at all
possible. You can set sarama.Logger to a log.Logger to capture Sarama debug
output.

logs: CLICK ME

INFO[2020-01-21 17:53:59.221] consumer/broker/35 closed dead subscription to topic_name/65
INFO[2020-01-21 17:53:59.221] consumer/broker/36 closed dead subscription to topic_name/66
INFO[2020-01-21 17:53:59.221] consumer/broker/38 closed dead subscription to topic_name/68
INFO[2020-01-21 17:53:59.221] consumer/broker/37 closed dead subscription to topic_name/67
INFO[2020-01-21 17:53:59.328] client/metadata fetching metadata for [topic_name] from broker broker-server01.nhnjp.ism:9092
INFO[2020-01-21 17:53:59.384] client/metadata fetching metadata for [topic_name] from broker broker-server09.nhnjp.ism:9092
INFO[2020-01-21 17:53:59.390] client/metadata fetching metadata for [topic_name] from broker broker-server08.nhnjp.ism:9092
INFO[2020-01-21 17:53:59.399] client/metadata fetching metadata for [topic_name] from broker broker-server02.nhnjp.ism:9092
INFO[2020-01-21 17:54:00.063] consumer/broker/39 closed dead subscription to topic_name/69
INFO[2020-01-21 17:54:01.029] Closing Client
INFO[2020-01-21 17:54:01.030] Closed connection to broker broker-server37.nhnjp.ism:9092
INFO[2020-01-21 17:54:01.030] Closed connection to broker broker-server35.nhnjp.ism:9092
INFO[2020-01-21 17:54:01.030] Closed connection to broker broker-server03.nhnjp.ism:9092
INFO[2020-01-21 17:54:01.030] Closed connection to broker broker-server38.nhnjp.ism:9092
INFO[2020-01-21 17:54:01.030] consumer/broker/1 closed dead subscription to topic_name/12
INFO[2020-01-21 17:54:01.030] Closed connection to broker broker-server08.nhnjp.ism:9092
INFO[2020-01-21 17:54:01.030] Closed connection to broker broker-server39.nhnjp.ism:9092
INFO[2020-01-21 17:54:01.030] Closed connection to broker broker-server36.nhnjp.ism:9092
INFO[2020-01-21 17:54:01.030] consumer/broker/10 closed dead subscription to topic_name/11
INFO[2020-01-21 17:54:01.030] consumer/broker/36 closed dead subscription to topic_name/10
INFO[2020-01-21 17:54:01.030] consumer/broker/12 closed dead subscription to topic_name/13
INFO[2020-01-21 17:54:01.030] consumer/broker/13 closed dead subscription to topic_name/14
INFO[2020-01-21 17:54:02.133] consumer/broker/28 closed dead subscription to topic_name/58
INFO[2020-01-21 17:54:02.133] consumer/broker/27 closed dead subscription to topic_name/57
INFO[2020-01-21 17:54:02.143] consumer/broker/40 closed dead subscription to topic_name/31
INFO[2020-01-21 17:54:02.143] consumer/broker/9 closed dead subscription to topic_name/30
INFO[2020-01-21 17:54:02.143] consumer/broker/31 closed dead subscription to topic_name/34
INFO[2020-01-21 17:54:02.143] consumer/broker/21 closed dead subscription to topic_name/33
INFO[2020-01-21 17:54:02.143] consumer/broker/22 closed dead subscription to topic_name/32
INFO[2020-01-21 17:54:02.392] Closing Client
INFO[2020-01-21 17:54:02.393] Closed connection to broker broker-server12.nhnjp.ism:9092
INFO[2020-01-21 17:54:02.393] Closed connection to broker broker-server36.nhnjp.ism:9092
INFO[2020-01-21 17:54:02.393] Closed connection to broker broker-server01.nhnjp.ism:9092
INFO[2020-01-21 17:54:02.393] Closed connection to broker broker-server03.nhnjp.ism:9092
INFO[2020-01-21 17:54:02.393] Closed connection to broker broker-server13.nhnjp.ism:9092
INFO[2020-01-21 17:54:02.393] Closed connection to broker broker-server01.nhnjp.ism:9092
INFO[2020-01-21 17:54:02.393] Closed connection to broker broker-server10.nhnjp.ism:9092
INFO[2020-01-21 17:54:02.577] consumer/broker/26 closed dead subscription to topic_name/56
INFO[2020-01-21 17:54:02.635] consumer/broker/29 closed dead subscription to topic_name/59
INFO[2020-01-21 17:54:02.716] consumer/broker/25 closed dead subscription to topic_name/55
INFO[2020-01-21 17:54:03.031] client/metadata fetching metadata for [topic_name] from broker broker-server02.nhnjp.ism:9092
INFO[2020-01-21 17:54:03.079] Closing Client
INFO[2020-01-21 17:54:03.079] Closed connection to broker broker-server25.nhnjp.ism:9092
INFO[2020-01-21 17:54:03.079] Closed connection to broker broker-server28.nhnjp.ism:9092
INFO[2020-01-21 17:54:03.079] Closed connection to broker broker-server29.nhnjp.ism:9092
INFO[2020-01-21 17:54:03.079] Closed connection to broker broker-server27.nhnjp.ism:9092
INFO[2020-01-21 17:54:03.079] Closed connection to broker broker-server26.nhnjp.ism:9092
INFO[2020-01-21 17:54:03.079] Closed connection to broker broker-server09.nhnjp.ism:9092
INFO[2020-01-21 17:54:03.079] Closed connection to broker broker-server03.nhnjp.ism:9092
INFO[2020-01-21 17:54:03.176] client/coordinator requesting coordinator for consumergroup consumer-group from broker-server02.nhnjp.ism:9092
INFO[2020-01-21 17:54:03.216] client/coordinator coordinator for consumergroup consumer-group is #3 (broker-server03.nhnjp.ism:9092)
INFO[2020-01-21 17:54:03.514] client/metadata fetching metadata for [topic_name] from broker broker-server02.nhnjp.ism:9092
INFO[2020-01-21 17:54:03.556] client/metadata fetching metadata for [topic_name] from broker broker-server02.nhnjp.ism:9092
INFO[2020-01-21 17:54:03.564] Closing Client
INFO[2020-01-21 17:54:03.565] Closed connection to broker broker-server03.nhnjp.ism:9092
INFO[2020-01-21 17:54:03.565] Closed connection to broker broker-server40.nhnjp.ism:9092
INFO[2020-01-21 17:54:03.565] Closed connection to broker broker-server22.nhnjp.ism:9092
INFO[2020-01-21 17:54:03.565] Closed connection to broker broker-server09.nhnjp.ism:9092

Problem Description

I'm using almost the same code here.
https://github.com/Shopify/sarama/blob/master/examples/consumergroup/main.go

While I running below codes, It often panics.

cancel()
wg.Wait()
if err = client.Close(); err != nil {
	log.Panicf("Error closing client: %v", err)
}

Here's panic log.

panic: assignment to entry in nil map

goroutine 5790856 [running]:
github.com/Shopify/sarama.(*client).registerBroker(0xc003a06090, 0xc005eb6e00)
        github.com/Shopify/sarama@v1.24.1/client.go:533 +0x2cb
github.com/Shopify/sarama.(*client).updateMetadata(0xc003a06090, 0xc0024f9310, 0xc0024f9300, 0x0, 0x0, 0x0)
        github.com/Shopify/sarama@v1.24.1/client.go:844 +0xde
github.com/Shopify/sarama.(*client).tryRefreshMetadata(0xc003a06090, 0xc006f2c3d0, 0x1, 0x1, 0x3, 0x0, 0x0, 0x0, 0x2a, 0x7f286d7f2d01)
        github.com/Shopify/sarama@v1.24.1/client.go:789 +0x831
github.com/Shopify/sarama.(*client).RefreshMetadata(0xc003a06090, 0xc006f2c3d0, 0x1, 0x1, 0xc0024f92c8, 0x1)
        github.com/Shopify/sarama@v1.24.1/client.go:442 +0xb0
github.com/Shopify/sarama.(*consumerGroup).topicToPartitionNumbers(0xc0038747e0, 0xc006f2c3d0, 0x1, 0x1, 0x0, 0x0, 0x0)
        github.com/Shopify/sarama@v1.24.1/consumer_group.go:472 +0x72
github.com/Shopify/sarama.(*consumerGroup).loopCheckPartitionNumbers(0xc0038747e0, 0xc006f2c3d0, 0x1, 0x1, 0xc002215700)
        github.com/Shopify/sarama@v1.24.1/consumer_group.go:450 +0x105
created by github.com/Shopify/sarama.(*consumerGroup).Consume
        github.com/Shopify/sarama@v1.24.1/consumer_group.go:178 +0x236

It seems that ConsumerGroupHandler's ConsumeClaim loop still not return even though group.Close() called.

@kimtree
Copy link
Author

kimtree commented Jan 28, 2020

It seems same issue with #1531 I'll check again after update sarama's version.

@kimtree
Copy link
Author

kimtree commented Feb 6, 2020

Not reproducible after I've updated to v1.26.0.

@kimtree kimtree closed this as completed Feb 6, 2020
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

No branches or pull requests

1 participant