Comcast / plax

A test automation engine for messaging systems
Apache License 2.0
7 stars 14 forks source link

Redaction gear not safe for concurrent use but is sometimes used that way #139

Closed jsccast closed 3 years ago

jsccast commented 3 years ago
fatal error: concurrent map iteration and map write
​
goroutine 3544 [running]:
runtime.throw(0x1339641, 0x26)
    runtime/panic.go:1117 +0x72 fp=0xc00077fcd0 sp=0xc00077fca0 pc=0x436692
runtime.mapiternext(0xc00077fdc0)
    runtime/map.go:858 +0x54c fp=0xc00077fd50 sp=0xc00077fcd0 pc=0x410b2c
github.com/Comcast/plax/dsl.(*Ctx).Redactf(0xc00026f420, 0xc000a516c8, 0x16, 0xc000a51728, 0x2, 0x2)
    github.com/Comcast/plax@v0.8.16/dsl/ctx.go:226 +0x127 fp=0xc00077fe30 sp=0xc00077fd50 pc=0xab4427
github.com/Comcast/plax/dsl.(*Ctx).Logf(...)
    github.com/Comcast/plax@v0.8.16/dsl/ctx.go:262
github.comcast.com/IoTPlatform/Test/cmd/plaxrun/plugins/chans.NewMQTTChan.func1(0x15629b0, 0xc0000ea000, 0x155f488, 0xc0007eaaf0)
    github.comcast.com/IoTPlatform/Test/cmd/plaxrun/plugins/chans/plaxos_mqttk.go:338 +0x469 fp=0xc00077ff90 sp=0xc00077fe30 pc=0x10d4689
github.comcast.com/IoTPlatform/paho%2emqtt%2egolang.(*router).matchAndDispatch.func2(0xc000984de0, 0xc0000ea000, 0x155f488, 0xc0007eaaf0)
    github.comcast.com/IoTPlatform/paho.mqtt.golang@v0.0.0-20200608170929-083d0cf4d532/router.go:160 +0x54 fp=0xc00077ffc0 sp=0xc00077ff90 pc=0x10cf334
runtime.goexit()
    runtime/asm_amd64.s:1371 +0x1 fp=0xc00077ffc8 sp=0xc00077ffc0 pc=0x46c081
created by github.comcast.com/IoTPlatform/paho%2emqtt%2egolang.(*router).matchAndDispatch
    github.comcast.com/IoTPlatform/paho.mqtt.golang@v0.0.0-20200608170929-083d0cf4d532/router.go:159 +0x607
​
goroutine 1 [runnable]:
strings.TrimFunc(0xc000884eb0, 0x10, 0xc00048c4a0, 0xc00062b3e8, 0xc00062b360)
    strings/strings.go:752 +0xc5
strings.Trim(0xc000884eb0, 0x10, 0x1309a53, 0x3, 0xc0005367cd, 0x3)
    strings/strings.go:840 +0x7d
github.com/Comcast/plax/dsl.WantsRedaction(...)
    github.com/Comcast/plax@v0.8.16/dsl/ctx.go:141
robertfarnum commented 3 years ago

In this case it was the MQTT Channel that was logging via the new redact functionality. Are channels created in separate goroutines? If all logging is via Redactf then there are many possible concurrent uses.