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

Push Consumer goroutine leak. #884

Closed
lampnick opened this issue Aug 4, 2022 · 0 comments · Fixed by #885
Closed

Push Consumer goroutine leak. #884

lampnick opened this issue Aug 4, 2022 · 0 comments · Fixed by #885

Comments

@lampnick
Copy link
Contributor

lampnick commented Aug 4, 2022

The issue tracker is ONLY used for the go client (feature request of RocketMQ need to follow RIP process). Keep in mind, please check whether there is an existing same report before your raise a new one.

Alternately (especially if your communication is not a bug report), you can send mail to our mailing lists. We welcome any friendly suggestions, bug fixes, collaboration, and other improvements.

Please ensure that your bug report is clear and that it is complete. Otherwise, we may be unable to understand it or to reproduce it, either of which would prevent us from fixing the bug. We strongly recommend the report(bug report or feature request) could include some hints as to the following:

BUG REPORT

  1. Please describe the issue you observed:
    When topic not exists. The start method return error message, but not close goroutine.
for i := 0; i <= 100; i++ {
		opts := []consumer.Option{
			consumer.WithGroupName(normalGroup),
			consumer.WithInstance(namespace),
			consumer.WithMaxReconsumeTimes(5),               //消息最大重试消费次数
			consumer.WithPullBatchSize(1),                   //批量拉取时最大拉取数
			consumer.WithConsumeMessageBatchMaxSize(int(1)), //批量消费最大推送数量
			consumer.WithNamespace(namespace),
			consumer.WithNsResolver(primitive.NewPassthroughResolver([]string{tcpEp})),
			consumer.WithCredentials(primitive.Credentials{
				AccessKey: accessKey,
				SecretKey: secretKey,
			}),
		}

		c, err := rocketMQ.NewPushConsumer(
			opts...,
		)
		if err != nil {
			log.Fatalln("rocketMQ.NewPushConsumer err: ", err)
		}

		selector := consumer.MessageSelector{Type: consumer.TAG, Expression: normalTag}
		if err = c.Subscribe(topic, selector, normalMsgHandler()); err != nil {
			log.Fatalln("rocketMQ.Subscribe err: ", err)
		}

		if err = c.Start(); err != nil {
			log.Println("rocketMQ.Start err: ", err)
			continue
		}
		if err = c.Shutdown(); err != nil {
			log.Fatalln("rocketMQ.Shutdown err: ", err)
		}
	}

using pprof can see the leak of goroutine.

101 @ 0x103c505 0x104d357 0x138e43a 0x1072721
#	0x138e439	git.myscrm.cn/golang/rocketmq-client-go/v2/consumer.(*pushConsumer).Start.func1.1+0xd9	/Users/nick/gomod/test/vendor/git.myscrm.cn/golang/rocketmq-client-go/v2/consumer/push_consumer.go:154

  1. Please tell us about your environment:

    • What is your OS?
      mac
    • What is your client version?
      v2.1.0
    • What is your RocketMQ version?
  2. Other information (e.g. detailed explanation, logs, related issues, suggestions on how to fix, etc):

FEATURE REQUEST

  1. Please describe the feature you are requesting.

  2. Provide any additional detail on your proposed use case for this feature.

  3. Indicate the importance of this issue to you (blocker, must-have, should-have, nice-to-have). Are you currently using any workarounds to address this issue?

  4. If there are some sub-tasks using -[] for each subtask and create a corresponding issue to map to the sub task:

lampnick pushed a commit to lampnick/rocketmq-client-go that referenced this issue Aug 4, 2022
@ShannonDing ShannonDing linked a pull request Aug 6, 2022 that will close this issue
5 tasks
ShannonDing pushed a commit that referenced this issue Aug 6, 2022
* [ISSUE #884]fix goroutine leak

* mock UnregisterConsumer
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

Successfully merging a pull request may close this issue.

1 participant