测试库一条update语句报错:ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

mysql> UPDATE profitloss_collect_form SET ApproveStatus = 2
    -> WHERE formcode = 'SY2015111803' AND (
    ->     SELECT COUNT(8) FROM profitloss_collect_form_detail WHERE formcode = 'SY2015111803' AND checkstatus = 0
    -> ) = 0;
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

update语句锁超时,一定是产生锁了。

mysql> select * from information_schema.innodb_trx\G
*************************** 1. row ***************************
                    trx_id: 3735875273
                 trx_state: RUNNING
               trx_started: 2015-12-07 16:55:32
     trx_requested_lock_id: NULL
          trx_wait_started: NULL
                trx_weight: 821
       trx_mysql_thread_id: 40566656
                 trx_query: NULL
       trx_operation_state: NULL
         trx_tables_in_use: 0
         trx_tables_locked: 0
          trx_lock_structs: 817
     trx_lock_memory_bytes: 95784
           trx_rows_locked: 104599
         trx_rows_modified: 4
   trx_concurrency_tickets: 0
       trx_isolation_level: REPEATABLE READ
         trx_unique_checks: 1
    trx_foreign_key_checks: 1
trx_last_foreign_key_error: NULL
 trx_adaptive_hash_latched: 0
 trx_adaptive_hash_timeout: 10000
          trx_is_read_only: 0
trx_autocommit_non_locking: 0
*************************** 2. row ***************************
                    trx_id: 3731614168
                 trx_state: RUNNING
               trx_started: 2015-12-07 11:14:59
     trx_requested_lock_id: NULL
          trx_wait_started: NULL
                trx_weight: 0
       trx_mysql_thread_id: 40317084
                 trx_query: insert into profitloss_collect_form_detail ........
       trx_operation_state: NULL
         trx_tables_in_use: 1
         trx_tables_locked: 0
          trx_lock_structs: 0
     trx_lock_memory_bytes: 360
           trx_rows_locked: 0
         trx_rows_modified: 0
   trx_concurrency_tickets: 0
       trx_isolation_level: REPEATABLE READ
         trx_unique_checks: 1
    trx_foreign_key_checks: 1
trx_last_foreign_key_error: NULL
 trx_adaptive_hash_latched: 0
 trx_adaptive_hash_timeout: 10000
          trx_is_read_only: 1
trx_autocommit_non_locking: 1
2 rows in set (0.00 sec)

mysql> kill 40317084;

ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction的更多相关文章

  1. ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction解决办法

    一.问题描述: 同事反馈线上一个表有其中一条数据无法删除,其他都正常,我拿到删数据的sql,尝试执行,报错如下: mysql> delete from facebook_posts where ...

  2. ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction 表被锁的解决办法

    转自:https://blog.csdn.net/mchdba/article/details/38313881 前言:朋友咨询我说执行简单的update语句失效,症状如下:mysql> upd ...

  3. Mysql错误:ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

    昨晚添加完索引之后, 查询整表的时候抛出Lock wait timeout exceeded; try restarting transaction, 吓死小白的我, 为什么条件查询可以, 整表查不了 ...

  4. 执行 update操作的时候有报错 ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

    mysql> show full processlist; #查看问题的线程!!!! 找到异常进程的ID 然后kill 掉: mysql> kill xxxxxxx; #xxxxxx是ID ...

  5. InternalError: (pymysql.err.InternalError) (1205, u'Lock wait timeout exceeded; try restarting transaction')

    在mysql innodb中使用事务,如果插入或者更新出错,一定要主动显式地执行rollback,否则可能产生不必要的锁而锁住其他的操作 我们在使用数据库的时候,可以使用contextlib,这样异常 ...

  6. com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction

    本文为博主原创: 以下为在程序运行过程中报的错误, org.springframework.dao.CannotAcquireLockException: ### Error updating dat ...

  7. MySQL应用报错:java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction

    开发反馈,某业务系统插入一条记录的时候,日志报错,插入失败: ### Error updating database. Cause: java.sql.SQLException: Lock wait ...

  8. com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction 问题解决

    有两种设置方法 第一种在mysql的配置文件中加入,然后重启mysql innodb_lock_wait_timeout = 500 第二种直接执行如下命令 set global innodb_loc ...

  9. MySQL事务锁等待超时 Lock wait timeout exceeded; try restarting transaction

    工作中处理定时任务分发消息时出现的问题,在查找并解决问题的时候,将相关的问题博客收集整理,在此记录下,以便之后再遇到相同的问题,方便查阅. 问题场景 问题出现的场景: 在消息队列处理消息时,同一事务内 ...

随机推荐

  1. spring事务失效

    最近在做spring 项目中突然发现事务在遇到异常是没有回滚而是提交了,在查了大量的资料之后,算是有了一点头绪,写下来方便以后查找: 前些日子一朋友在需要在目标对象中进行自我调用,且需要实施相应的事务 ...

  2. ubuntu创建、删除文件及文件夹,强制清空回收站方法

    mkdir 目录名         => 创建一个目录 rmdir 空目录名      => 删除一个空目录 rm 文件名 文件名   => 删除一个文件或多个文件 rm –rf 非 ...

  3. python 调用mysql存储过程返回结果集

    存储过程: delimiter | ),)) begin select * from tb_test where mid = imid and user = iuser; end; | delimit ...

  4. 在centos中创建nginx启动脚本

    1. 建立脚本文件nginxd [root@could]# vi /etc/init.d/nginxd 插入以下内容 #!/bin/bash## chkconfig: - 85 15# descrip ...

  5. sgu 185 最短路建网络流

    题目:给出一个图,从图中找出两条最短路,使得边不重复. 分析:既然是最短路,那么,两条路径上的所有节点的入边(s,x).出边(x,e)必定是最优的,即 dis[x] = dis[s]+edge_dis ...

  6. 苹果所有证书、appID、Provisioning Profiles配置说明及制作教程

    1.开发者证书(分为开发和发布两种,类型为ios Development,ios Distribution): 2.appID,这是每一个应用的独立标识,在设置项中可以配置该应用的权限,比如是否用到了 ...

  7. 统计机器学习(statistical machine learning)

    组要组成部分:监督学习(supervised learning),非监督学习(unsupervised learning),半监督学习(semi-supervised learning),强化学习(r ...

  8. Fuck Sharepoint 2013

    最近遇到一个貌似是bug的问题,每次点击页面的时候页面的地址多出一行/_layouts/15/start.aspx#/ 然后跑到google上搜索出解决方案, 地址:http://social.tec ...

  9. 数组去重算法,quickSort

    function removeRepeat(arr) { var arr2 = [] ,obj = {}; for (var i = 0; i<arr.length; i++) { var nu ...

  10. 用Drawing画图如何不会消失

    方法一:将事件放在form_Load中,在窗体中画图   1: protected void MainForm_Load(object sender,EventArgs e) 2: { 3: Init ...