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

[question] why SetLevelFromString and SetLevel are not thread-safe? #103

Open
Slach opened this issue Oct 16, 2022 · 0 comments
Open

[question] why SetLevelFromString and SetLevel are not thread-safe? #103

Slach opened this issue Oct 16, 2022 · 0 comments

Comments

@Slach
Copy link

Slach commented Oct 16, 2022

I want to reload config and setup global log level dynamically

But got race conditions
could you give any suggestions how to do it?

WARNING: DATA RACE
Write at 0x00000532fb30 by goroutine 94:
  github.com/apex/log.SetLevelFromString()
      /root/go/pkg/mod/github.com/apex/[email protected]/pkg.go:29 +0xd3
  github.com/AlexAkulov/clickhouse-backup/pkg/config.LoadConfig()
      /src/pkg/config/config.go:280 +0xb44
  github.com/AlexAkulov/clickhouse-backup/pkg/backup.(*Backuper).Watch()
      /src/pkg/backup/watch.go:95 +0x68e
  github.com/AlexAkulov/clickhouse-backup/pkg/server.(*APIServer).RunWatch()
      /src/pkg/server/server.go:140 +0x48e
  github.com/AlexAkulov/clickhouse-backup/pkg/server.Run.func2()
      /src/pkg/server/server.go:109 +0x5b

Previous read at 0x00000532fb30 by goroutine 93:
  github.com/apex/log.(*Logger).log()
      /root/go/pkg/mod/github.com/apex/[email protected]/logger.go:149 +0x8c
  github.com/apex/log.(*Entry).Info()
      /root/go/pkg/mod/github.com/apex/[email protected]/entry.go:96 +0x94
  github.com/apex/log.(*Entry).Infof()
      /root/go/pkg/mod/github.com/apex/[email protected]/entry.go:122 +0xec
  github.com/apex/log.(*Logger).Infof()
      /root/go/pkg/mod/github.com/apex/[email protected]/logger.go:121 +0xe4
  github.com/apex/log.Infof()
      /root/go/pkg/mod/github.com/apex/[email protected]/pkg.go:86 +0xc5
  github.com/AlexAkulov/clickhouse-backup/pkg/server.(*APIServer).UpdateBackupMetrics()
      /src/pkg/server/server.go:1148 +0x1c4
  github.com/AlexAkulov/clickhouse-backup/pkg/server.Run.func1()
      /src/pkg/server/server.go:103 +0xa4
@Slach Slach changed the title [question] why SetLevelFromString and SetLevel is non thread-safe? [question] why SetLevelFromString and SetLevel are not thread-safe? Oct 16, 2022
Slach added a commit to Altinity/clickhouse-backup that referenced this issue Jun 12, 2023
mskwon pushed a commit to mskwon/clickhouse-backup that referenced this issue Jun 14, 2023
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

No branches or pull requests

1 participant