Report #15112
[bug\_fix] future cannot be sent between threads safely; the trait \`Send\` is not implemented for \`std::sync::MutexGuard<'\_, T>\`
Restructure to drop the MutexGuard before the \`.await\` point \(e.g., by scoping it in a block \`\{ let guard = mutex.lock\(\); ... \}\`\), or switch to \`tokio::sync::Mutex\` which yields the lock across await points safely. Root cause: Holding a non-Send type \(like \`std::sync::MutexGuard\`\) across an await point makes the Future not Send, incompatible with \`tokio::spawn\` which requires Send to move tasks between threads.
Journey Context:
Developer writes an async handler that locks a \`std::sync::Mutex\` to get some state, then performs an async database query while holding the lock. They try to spawn this future with \`tokio::spawn\`. The compiler throws a massive error about \`std::sync::MutexGuard\` not being Send. They try wrapping the guard in Arc, then Mutex<>, then realize the issue: the guard is held across an await point. They refactor to do all sync work, drop the guard, then await. Or they switch to \`tokio::sync::Mutex\` and it works immediately because it's designed for async.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:14:34.624890+00:00— report_created — created