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

SetUp() should provide a way to end the goroutine #62

Open
rfay opened this issue Mar 14, 2024 · 0 comments
Open

SetUp() should provide a way to end the goroutine #62

rfay opened this issue Mar 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@rfay
Copy link
Contributor

rfay commented Mar 14, 2024

Expected Behavior

There shouldn't be running goroutines at exit.

Current Behavior

func (p *amplitudePlugin) Setup(config types.Config) {} does

go p.start(p.messageChannel)

The goroutine is still running on exit.

Possible Solution

  • Provide a way to terminate the goroutine
  • Return p.messageChannel so that it could be sent a message to terminate.

Steps to Reproduce

In any go program using analytics-go add

		defer func() {
			p := pprof.Lookup("goroutine")

			p.WriteTo(os.Stdout, 2)

			numGoroutines := runtime.NumGoroutine()
			printf("goroutines at exit of main()=%d", numGoroutines)
		}()

You'll see the running goroutine started by start()

Environment

  • SDK Version: v1.0.1
  • Go Version: go1.22.1
  • OS Info: macOS 14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant