Skip to content

Make command stats logging concurrency-safe

Igor requested to merge cmd-stats-concurrent-log into master

We utilize grpc_logrus.WithMessageProducer() to read out command stats in a way that does not mutate the shared logging context used by ctxlogrus and grpc_logrus interceptors.

This is an attempt to unblock #3308 (closed).

We ran into a crash #3280 (closed) due to concurrent reads and writes when using ctxlogrus.AddFields(). I attempted to make upstream concurrency safe (upstream MR) but they weren't too keen on adding the lock.

This is an attempt to deal with the issue on our end by hooking into grpc_logrus.WithMessageProducer.

Note that I had to bump the grpc dependency as a transitive update from go-grpc-middleware, whose update introduced WithMessageProducer. There are a few changes related to this bump, I've kept them in a separate commit to ease code review.

Edited by Igor

Merge request reports

Loading