Merge "Crash shell if callers use the wrong thread" into main