V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2022-01-13 17:05:14 +08:00 · 1839 次点击
    这是一个创建于 827 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    5 条回复    2022-01-14 12:00:38 +08:00
    zhoudaiyu
        1
    zhoudaiyu  
       2022-01-13 17:21:33 +08:00
    https://github.com/rq/rq-scheduler/issues/257 可以看看这个 xd 的自问自答里面的两个 here
    taomujian
        2
    taomujian  
    OP
       2022-01-13 17:40:23 +08:00
    @zhoudaiyu 看过了,并没有什么解决方法,只是说 Lock already taken - skipping run 是一个特性。。。。
    corvofeng
        3
    corvofeng  
       2022-01-13 18:00:42 +08:00
    killed 是不是容器内存满了, 进程被停了
    taomujian
        4
    taomujian  
    OP
       2022-01-13 18:07:20 +08:00
    @corvofeng 有可能,不过运行的程序都是在主机上,只有 es,mongodb,redis 用的 docker,我把 es 切换到主机上
    julyclyde
        5
    julyclyde  
       2022-01-14 12:00:38 +08:00
    Killed 十有八九都是内存满。你看 dmesg 吧
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2808 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 14:00 · PVG 22:00 · LAX 07:00 · JFK 10:00
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.