I don't know what to suggest next except to debug it. It may have nothing to do with locking. Maybe conn or conn->peer are being used after being freed.