kin-openapi icon indicating copy to clipboard operation
kin-openapi copied to clipboard

Concurrent map writes error in RegisterBodyEncoder

Open natehart opened this issue 2 years ago • 0 comments

The bodyEncoders map is not thread safe. If encoders are registered in parallel, this line can cause a fatal "concurrent map writes" error. I discovered this due to having parallel tests that each used a new instance of my rest server.

This is likely low priority as this should't really ever happen in production code, but it's probably still worth making this map thread safe by adding a read-write mutex to guard all functions that access that map.

natehart avatar Feb 29 '24 19:02 natehart