起因
@transaction.atomic
def post():
try:
s1 = transaction.savepoint()
raise
except Exception:
transaction.savepoint_rollback(s1)
现象
- 数据库死锁
猜测是因为 debug 调试时 没有走到下面的 transaction.savepoint_rollback(s1) 导致锁未释放?
查看数据库锁情况
select * from information_schema.innodb_trx;
干掉 trx_mysql_thread_id
kill trx_mysql_thread_id;
One comment
想想你的文章写的特别好https://www.237fa.com/