Once, we had a group that was not created, so our app code calling rocketmq.NewPushConsumer returned err. Since the retry mechanism, the method rocketmq.NewPushConsumer was called frequently, then we found that the memory kept growing.
I speculated that there was groutine leak. I use runtime.NumGoroutine() to print the number of groutines, which confirms this.
By investigating the code and adding debug logs, we found that after calling pushConsumer.Shutdown(), one goroutine in pushConsumer.Start and some statistics-related goroutines could not exit in time and were blocked in sleep. The following are some of the blocking points.
BUG REPORT
Once, we had a group that was not created, so our app code calling rocketmq.NewPushConsumer returned err. Since the retry mechanism, the method
rocketmq.NewPushConsumer
was called frequently, then we found that the memory kept growing.I speculated that there was groutine leak. I use runtime.NumGoroutine() to print the number of groutines, which confirms this.
By investigating the code and adding debug logs, we found that after calling pushConsumer.Shutdown(), one goroutine in
pushConsumer.Start
and some statistics-related goroutines could not exit in time and were blocked in sleep. The following are some of the blocking points.push_consumer.go
consumer/statistics.go
My advice:
time.NewTicker will not be executed immediately, but after the Ticker cycle, so I think the sleep code of these routines is unnecessary.