Using the locale takes a mutex deep in the C++ library. Avoid this on hot compilation paths, e.g. in the validator. Fixed: #5802