Race condition in LOG_PROTOCOL_WARN
LOG_PROTOCOL_WARN currently calls get_options(). After legacy/trac#23952 (moved) is merged, it will call get_protocol_warning_severity_level(). The trouble is, both of these functions access a global variable without acquiring a lock... and LOG_PROTOCOL_WARN can be invoked from outside the main thread.
Let's fix this once legacy/trac#23952 (moved) and legacy/trac#23953 (moved) are merged.