opencensus-go icon indicating copy to clipboard operation
opencensus-go copied to clipboard

Goroutine started on init() function

Open adrianlzt opened this issue 5 years ago • 4 comments

Describe the bug In this init() function a gorouting is fired.

This looks like an strange behaviour for a lib, because any program importing this lib will have your goroutine running. Found looking for a problem in Telegraf: https://github.com/influxdata/telegraf/pull/5612

adrianlzt avatar Mar 20 '19 15:03 adrianlzt

Found this goroutine running during my tests today. This strikes me as extremely bad practice to start unwanted goroutines no matter how "cheap" they are. If the package requires a Goroutine to run, starting it should be part of the public API that users have to start themselves.

aarondl avatar Apr 10 '19 19:04 aarondl

Likewise importing these google APIs will also start the mystery go routine

  • google.golang.org/api/drive/v2
  • google.golang.org/api/drive/v3
  • google.golang.org/api/storage/v1

ncw avatar Aug 08 '19 22:08 ncw

I can't explain how, but I believe this goroutine has a serious bug causing the CPU to spin, and somehow blocking program start. Reported in: #1200

mholt avatar Mar 09 '20 23:03 mholt

agreed this should not be happening. i had to investigate wtf the library was and whether it posed a security risk to my application.

james-lawrence avatar Jan 30 '21 17:01 james-lawrence