V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
KeatingSmith
V2EX  ›  问与答

Flask 中 MySQL 锁的问题

  •  
  •   KeatingSmith · Jul 26, 2018 · 2193 views
    This topic created in 2832 days ago, the information mentioned may be changed or developed.

    环境:

    • Web:Flask
    • Database: MySQL
    • ORM: peewee

    现在遇到的问题是这样的:

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

    遇到并发的时候(其实没有多少),报错,是事务锁的问题,我在 StackOverflow 上并没有找到解决的方案,

    请问下 V2EX 上的前辈们,这种问题,应该从何下手呢?

    新手,)害羞。

    4 replies    2018-07-26 17:57:17 +08:00
    yongzhong
        1
    yongzhong  
       Jul 26, 2018
    没有代码,无从分析

    没用过 peewee,不太清楚

    跟着官方文档走一遍吧
    KeatingSmith
        2
    KeatingSmith  
    OP
       Jul 26, 2018
    首先,排除了 Flask 并发请求的错误,因为是根据错误信息来看,是因为 MySQL 事务导致锁的原因。
    wps353
        3
    wps353  
       Jul 26, 2018
    show engine innodb status \G;
    看看具体什么情况。
    KeatingSmith
        4
    KeatingSmith  
    OP
       Jul 26, 2018
    @wps353

    REPEATABLE_READ
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   956 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 20:47 · PVG 04:47 · LAX 13:47 · JFK 16:47
    ♥ Do have faith in what you're doing.