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 · 1 comment
Open

DATA RACE in config watch #3479

dingyalin opened this issue Dec 3, 2024 · 1 comment
Labels
bug Something isn't working stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed

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
Copy link

dosubot bot commented Mar 4, 2025

Hi, @dingyalin. I'm Dosu, and I'm helping the Kratos team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • A data race condition is reported in the config watch functionality of the Kratos framework.
  • The race occurs between the SetLogger and Infof functions, accessed concurrently by different goroutines.
  • The issue is currently unresolved, and there have been no comments or additional activity.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of the Kratos repository. If so, you can keep the discussion open by commenting on the issue.
  • If there is no further activity, the issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed
Projects
None yet
Development

No branches or pull requests

1 participant