The log code holds the log mutex(s) too long. Depending on the log level (trace+ is worst) the lock has been observed being held for > 30 milliseconds.
The log lock is a singleton that is acquired by all calls to qd_log (active log level only) - which means it is a global lock.
It appears as if the lock is held while doing I/O and alloc/dealloc'ing memory - which may be expensive (in qd_vlog_impl() in log.c):
// Bounded buffer of log entries, keep most recent.
qd_log_entry_t *entry = new_qd_log_entry_t();
entry->module = source->module;
entry->level = level;
entry->file = file ? strdup(file) : 0;
entry->line = line;
vsnprintf(entry->text, TEXT_MAX, fmt, ap);
if (DEQ_SIZE(entries) > LIST_MAX)