程序奔溃导致mysql事务未提交

> SHOW ENGINE INNODB STATUS;
RANSACTIONS
------------
Trx id counter 74862
Purge done for trx's n:o < 74862 undo n:o < 0 state: running but idle
History list length 2
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421544929007128, not started
0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 421544929006320, not started
0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 421544929002280, not started
0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 421544929000664, not started
0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 421544929005512, not started
0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 421544929001472, not started
0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 421544929004704, not started
0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 421544929003896, not started
0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 421544928999856, not started
0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 421544928999048, not started
0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 74858, ACTIVE 64 sec
2 lock struct(s), heap size 1128, 1 row lock(s)
MySQL thread id 46163, OS thread handle 140069038933568, query id 2915675 

可以发现有一个事务活跃64s, 线程是46163
通过show processlist,找到对应的线程kill

本作品采用《CC 协议》,转载必须注明作者和本文链接
用过哪些工具?为啥用这个工具(速度快,支持高并发...)?底层如何实现的?
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 7

可以设置超时自动回滚

1个月前 评论
Smilephp (作者) 1个月前
Runtoweb3 (楼主) 1个月前
Smilephp (作者) 1个月前
Runtoweb3 (楼主) 1个月前

try catch rollback不好使吗?mysql.ini中设置innodb_lock_wait_timeout.

1个月前 评论
Runtoweb3 (楼主) 1个月前

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!