The diagnostics_json call could access the std::unordered_map at the same time it was being updated by the monitoring thread. This leads to undefined behavior which in the case of MXS-3059 manifested as a segfault.