rtc tests: give the logger its own logging config

init() handed the logger &config.DefaultConfig.Logging, so the leveler's
mutex lived inside the global that NewConfig yaml-marshals. Marshalling
reflectively copies the whole struct, mutex included, which raced the
component-level lookups pion makes from its own goroutines and failed
TestPreferMediaCodecForPublisher under -race.

The values are the same; only the storage is now test-local. The integration
helper aliased the same global and gets the same treatment.
This commit is contained in:
Paul Wells
2026-09-16 15:44:34 -07:00
parent 2523c94520
commit c0073ce945
2 changed files with 10 additions and 2 deletions
+5 -1
View File
@@ -51,7 +51,11 @@ const (
)
func init() {
config.InitLoggerFromConfig(&config.DefaultConfig.Logging)
// the logger keeps this pointer, so it needs storage of its own: NewConfig
// yaml-marshals DefaultConfig, which reflectively copies the leveler's mutex
// while pion goroutines are locking it.
logging := config.LoggingConfig{PionLevel: config.DefaultConfig.Logging.PionLevel}
config.InitLoggerFromConfig(&logging)
roomUpdateInterval = defaultDelay
}
+5 -1
View File
@@ -63,7 +63,11 @@ const (
var roomClient livekit.RoomService
func init() {
config.InitLoggerFromConfig(&config.DefaultConfig.Logging)
// the logger keeps this pointer, so it needs storage of its own: NewConfig
// yaml-marshals DefaultConfig, which reflectively copies the leveler's mutex
// while pion goroutines are locking it.
logging := config.LoggingConfig{PionLevel: config.DefaultConfig.Logging.PionLevel}
config.InitLoggerFromConfig(&logging)
prometheus.Init("test", livekit.NodeType_SERVER)
}