推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
taomujian
V2EX  ›  Python

python3 + gunicorn(多进程) + rq + subprocess 程序莫名 killed

  •  
  •   taomujian · Jan 13, 2022 · 3198 views
    This topic created in 1754 days ago, the information mentioned may be changed or developed.

    用 gunicorn 部署的一个程序,队列使用 rq,每个 worker 里调用 subprocess.Popen.communicate 去执行 go 程序,日志会保存到 log 文件,然后 python 读取 log 进行处理.当 gunicorn 配置文件中设置进程为多个时,rq 的日志文件会有警告 Lock already taken - skipping run,与此同时还有一条日志是 killed,go 程序就会被终止,python 也读取不了日志.当 gunicorn 配置文件中设置进程为 1 时则没有这个问题,这是哪里出问题了?

    5 replies  •  2022-01-14 12:00:38 +08:00
    zhoudaiyu
    zhoudaiyu
    Jan 13, 2022
    1
    https://github.com/rq/rq-scheduler/issues/257 可以看看这个 xd 的自问自答里面的两个 here
    taomujian
    taomujian
    OP
    Jan 13, 2022
    2
    @zhoudaiyu 看过了,并没有什么解决方法,只是说 Lock already taken - skipping run 是一个特性。。。。
    corvofeng
    corvofeng
    Jan 13, 2022
    3
    killed 是不是容器内存满了, 进程被停了
    taomujian
    taomujian
    OP
    Jan 13, 2022
    4
    @corvofeng 有可能,不过运行的程序都是在主机上,只有 es,mongodb,redis 用的 docker,我把 es 切换到主机上
    julyclyde
    julyclyde
    Jan 14, 2022
    5
    Killed 十有八九都是内存满。你看 dmesg 吧
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1755 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 23:58 · PVG 07:58 · LAX 15:58 · JFK 18:58
    ♥ Do have faith in what you're doing.