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

DATA RACE in config watch #3479

Open
dingyalin opened this issue Dec 3, 2024 · 0 comments
Open

DATA RACE in config watch #3479

dingyalin opened this issue Dec 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@dingyalin
Copy link

What happened:

==================
WARNING: DATA RACE
Write at 0x0000015bb0d8 by main goroutine:
  github.com/go-kratos/kratos/v2/log.(*loggerAppliance).SetLogger()
      vendor/github.com/go-kratos/kratos/v2/log/global.go:27 +0x8f
  github.com/go-kratos/kratos/v2/log.SetLogger()
      vendor/github.com/go-kratos/kratos/v2/log/global.go:33 +0x389
  github.com/go-kratos/kratos/v2.New()
     vendor/github.com/go-kratos/kratos/v2/app.go:53 +0x337
  main.newApp()
     main.go:38 +0x486
  main.wireApp()
    wire_gen.go:38 +0x4c4
  main.main()
   main.go:98 +0x173

Previous read at 0x0000015bb0d8 by goroutine 10:
  github.com/go-kratos/kratos/v2/log.Infof()
     vendor/github.com/go-kratos/kratos/v2/log/global.go:73 +0x164
  github.com/go-kratos/kratos/v2/config.(*config).watch()
     vendor/github.com/go-kratos/kratos/v2/config/config.go:67 +0x384
  github.com/go-kratos/kratos/v2/config.(*config).Load.gowrap1()
      vendor/github.com/go-kratos/kratos/v2/config/config.go:115 +0x4f

Goroutine 10 (finished) created at:
  github.com/go-kratos/kratos/v2/config.(*config).Load()
      vendor/github.com/go-kratos/kratos/v2/config/config.go:115 +0x5e
  main.parseConfig()
    main.go:58 +0x2da
  main.main()
     main.go:91 +0x2b
==================

What you expected to happen:

no data race

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Kratos version (use kratos -v): 2.8.2
  • Go version (use go version): 1.22.9
  • OS (e.g: cat /etc/os-release):
  • Others:
@dingyalin dingyalin added the bug Something isn't working label Dec 3, 2024
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