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
zonghua
V2EX  ›  Python

程序都嘶叫起来了。uWSGI worker 1 screams: UAAAAAAH my master disconnected: i will kill myself !!!

  •  
  •   zonghua · 2016-04-04 11:40:33 +08:00 · 6592 次点击
    这是一个创建于 3157 天前的主题,其中的信息可能已经有所发展或是发生改变。

    supervisor + uwsgi

    无法重启程序

    *** Operational MODE: preforking ***
    WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x24ec4e0 pid: 4274 (default app)
    *** uWSGI is running in multiple interpreter mode ***
    gracefully (RE)spawned uWSGI master process (pid: 4274)
    spawned uWSGI worker 1 (pid: 4348, cores: 1)
    spawned uWSGI worker 2 (pid: 4349, cores: 1)
    spawned uWSGI worker 3 (pid: 4350, cores: 1)
    spawned uWSGI worker 4 (pid: 4351, cores: 1)
    Mon Apr  4 11:29:32 2016 - uWSGI worker 1 screams: UAAAAAAH my master disconnected: i will kill myself !!!
    Mon Apr  4 11:29:32 2016 - uWSGI worker 2 screams: UAAAAAAH my master disconnected: i will kill myself !!!
    

    执行重启命令

    sudo supervisorctl start demo
    demo: ERROR (abnormal termination)
    

    uwsgi.log 可能是重启的时候 uwsgi 进程仍在监听该端口

    probably another instance of uWSGI is running on the same address (127.0.0.1:8001).
    bind(): Address already in use [core/socket.c line 769]
    

    我的配置文件 uwsgi.ini

    [uwsgi]
    # Django-related settings
    chdir           = /home/www/Documents/demo
    module          = demo.wsgi:application
    env             = DJANGO_SETTINGS_MODULE=demo.settings_production
    home            = /home/www/Documents/demo/venv
    user            = www
    uid             = www
    pcre-jit
    thunder-lock
    enable-threads
    master          = true
    touch-reload    = /home/www/Documents/demo/reload
    processes       = 4
    socket          = 127.0.0.1:8001
    chmod-socket    = 664
    vacuum          = true
    

    supervios conf

    [program:vblue]
    directory= /home/www/Documents/demo
    command = /home/www/Documents/demo/venv/bin/uwsgi --ini /home/www/Documents/demo/uwsgi.ini
    autostart=true
    autorestart=true
    redirect_stderr = true
    stdout_logfile = /home/www/Documents/demo/logs/out.log
    stdout_logfile_maxbytes = 1MB
    stderr_logfile= /home/www/Documents/demo/logs/err.log
    

    不知道怎么重启的时候关掉 uwsgi 进行监控, 官方文档只有推荐用 Circus

    8 条回复    2016-04-05 14:25:18 +08:00
    indust
        1
    indust  
       2016-04-04 12:08:34 +08:00 via Android
    stopsignal=QUIT
    zonghua
        2
    zonghua  
    OP
       2016-04-04 12:42:52 +08:00
    @indust http://uwsgi-docs.readthedocs.org/en/latest/Options.html?highlight=pidfile#stop 感觉不需要 supervisor 了, uwsgi 本身就有一个主从的守护进程。
    refraction
        3
    refraction  
       2016-04-04 18:11:17 +08:00 via Android   ❤️ 1
    这报错信息实在是 哈哈哈哈
    zonghua
        4
    zonghua  
    OP
       2016-04-04 18:58:35 +08:00 via iPhone
    @refraction 有分享一下配置文件吗
    refraction
        5
    refraction  
       2016-04-04 20:22:16 +08:00
    @zonghua 啊?回复错人了吧
    clino
        6
    clino  
       2016-04-05 11:54:32 +08:00   ❤️ 1
    看不出是什么原因导致的 master 进程挂掉

    '执行重启命令

    sudo supervisorctl start demo'
    然而这个并不是重启命令,重启是 restart

    我经常加的 supervisor 参数有这两个,你试试看有木有用:
    stopsignal=QUIT
    exitcodes=0,1,2 //根据你的情况改

    另外直接用 uwsgi 自己跑试试看有没有 master 会挂掉的问题? 如果 uwsgi 单独跑不会出问题,但是用 supervisor 跑有问题,考虑和 supervisor 的参数有没有关系.
    zonghua
        7
    zonghua  
    OP
       2016-04-05 13:20:23 +08:00
    @clino 我先 stop 了,然后再 start 的。嗯,我试一下用关闭信号。
    clino
        8
    clino  
       2016-04-05 14:25:18 +08:00
    @zonghua 如果你先 stop 还这么提示 说明要么没真正停止,要么变僵尸进程了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5698 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 06:43 · PVG 14:43 · LAX 22:43 · JFK 01:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.