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

close dangling autoDiscovery goroutine in consumer #411

Merged
merged 2 commits into from
Dec 10, 2020

Conversation

zzzming
Copy link
Contributor

@zzzming zzzming commented Dec 9, 2020

Motivation

The goroutine for auto discovery partitions has never been closed even when consumer is Close()
https://github.com/apache/pulsar-client-go/blob/v0.3.0/pulsar/consumer_impl.go#L236

Currently consumer Close() will stop() the ticker, however, Stop() does not close the ticker's channel. The behaviour is described at https://golang.org/pkg/time/#Ticker.Stop

This bug can leave a large number of dangling goroutines, that results in high CPU consumption.

Modifications

The fix is to introduce a signal channel to send a signal to terminate the partition auto discovery goroutine upon consumer Close().

Verifying this change

  • Make sure that the change passes the CI checks.

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): no
  • The public API: no
  • The schema: no
  • The default values of configurations: no
  • The wire protocol: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? (not applicable)
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a followup issue for adding the documentation

@merlimat merlimat added this to the 0.4.0 milestone Dec 10, 2020
@merlimat merlimat merged commit 4d6848d into apache:master Dec 10, 2020
@zzzming zzzming deleted the exitConsumerRoutine branch January 25, 2021 15:26
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 this pull request may close these issues.

None yet

2 participants