darksand
V2EX  ›  问与答

celery 经常卡死,有大神遇到过吗

  •  
  •   darksand · Aug 6, 2018 · 2449 views
    This topic created in 2835 days ago, the information mentioned may be changed or developed.

    celery worker 经常卡死,例如 并发数 是 4,然后经常就有 4 个任务状态卡在 started 或者 received 不动,然后也不会抛出异常。我是设置了超时的 CELERYD_TASK_SOFT_TIME_LIMIT = 120

    但是时间过了很久 也不会抛出 异常 SoftTimeLimitExceeded

    我看文档是肯定会抛出的。但是这个有的时候能抛出,有的时候不会抛出,然后就卡死在那个地方! 整了一周了还是没找到问题

    2 replies    2018-08-07 10:58:15 +08:00
    yongzhong
        1
    yongzhong  
       Aug 6, 2018
    http://docs.celeryproject.org/en/latest/userguide/optimizing.html#prefork-pool-prefetch-settings

    你的任务是否是执行时间较长的,celery 有 prefork 机制,任务会预先分配到 worker 上,如果这个 worker 执行任务阻塞,那这个 worker 上后续的任务阻塞,并不会自动调度到其他空闲 worker 上
    darksand
        2
    darksand  
    OP
       Aug 7, 2018
    @yongzhong 谢谢!我这边 prefetch 都设置的 1,仍然会卡住
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6138 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 02:03 · PVG 10:03 · LAX 19:03 · JFK 22:03
    ♥ Do have faith in what you're doing.