Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

启动失败 #16

Closed
Zynismus16 opened this issue Sep 9, 2021 · 8 comments
Closed

启动失败 #16

Zynismus16 opened this issue Sep 9, 2021 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@Zynismus16
Copy link

Zynismus16 commented Sep 9, 2021

感谢开发者开源这么棒的程序
我在搭建程序时遇到了一些问题,希望能解惑。
在进行到配置文件环节时,文档有写,加载config.py同级文件.cfg,我查找了该目录并没有发现,于是我按照配置手动创建,文件内容如下

sapic_redis_url=redis://:********@127.0.0.1:6379/1
sapic_host=127.0.0.1
sapic_port=9514
sapic_loglevel=ERROR
sapic_maxupload=30
SecretKey=******

创建完成后执行启动命令
sh online_gunicorn.sh start

报错提示
picbed/src/logs/sapic.pid: No such file or directory
我大概阅读了下,提示是指没有sapic.pid这个文件,于是我去该目录手动 创建了
但又提示
picbed/src/logs/sapic.pid, please check, exit.
我猜想该文件内容有着特殊的格式
希望开发者能解惑,

@staugur
Copy link
Member

staugur commented Sep 9, 2021

早好。

  • .cfg是用户自己创建的配置文件,一行一个(你的描述没看到换行,注意文本内容保持换行)。

  • logs这个目录启动脚本会自动创建,包括pid,如没有确实有问题,可能是创建logs目录失败

可以提供版本号(或git commit),什么环境下搭建(操作系统及python版本)

@Zynismus16
Copy link
Author

你好,cfg我是有换行的,这个应该是github给我取消了,
另外,logs目录有error.log gunicorn.log sys.log 三个文件 ,sapic.pid文件在我刚开始查看时确实没有,我手动创建过空文件,并命名。
我拉取的是https://github.com/sapicd/sapic/releases/tag/1.13.2版本
另外,系统是Ubuntu18.4 python2

@staugur
Copy link
Member

staugur commented Sep 9, 2021

用ps查下本机有没有sapic进程(或看看有没有9514端口在监听),或者直接 make restart (即 sh online_gunicorn.sh restart) 关闭重启

@Zynismus16
Copy link
Author

Zynismus16 commented Sep 9, 2021

我刚刚看了一下日志,

[2021-09-09 01:31:44 +0000] [10295] [INFO] Worker exiting (pid: 10295)
[2021-09-09 01:31:44 +0000] [10291] [INFO] Shutting down: Master
[2021-09-09 01:31:44 +0000] [10291] [INFO] Reason: Worker failed to boot.
[2021-09-09 02:04:07 +0000] [16177] [INFO] Starting gunicorn 19.10.0
[2021-09-09 02:04:07 +0000] [16177] [INFO] Listening at: http://127.0.0.1:9514 (16177)
[2021-09-09 02:04:07 +0000] [16177] [INFO] Using worker: gevent
[2021-09-09 02:04:07 +0000] [16181] [INFO] Booting worker with pid: 16181
[2021-09-09 02:04:07 +0000] [16181] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 586, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/ggevent.py", line 196, in init_process
    self.patch()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/ggevent.py", line 65, in patch
    monkey.patch_all(subprocess=True)
  File "/usr/local/lib/python2.7/dist-packages/gevent/monkey.py", line 1237, in patch_all
    _notify_patch(events.GeventWillPatchAllEvent(modules_to_patch, kwargs), _warnings)
  File "/usr/local/lib/python2.7/dist-packages/gevent/monkey.py", line 190, in _notify_patch
    notify_and_call_entry_points(event)
  File "/usr/local/lib/python2.7/dist-packages/gevent/events.py", line 104, in notify_and_call_entry_points
    subscriber = plugin.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2323, in load
    self.require(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2346, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 778, in resolve
    raise DistributionNotFound(req, requirers)
DistributionNotFound: The 'psutil>=5.7.0; sys_platform != "win32" or platform_python_implementation == "CPython" and extra == "recommended"' distribution was not found and is required by the application
[2021-09-09 02:04:07 +0000] [16181] [INFO] Worker exiting (pid: 16181)
[2021-09-09 02:04:07 +0000] [16177] [INFO] Shutting down: Master
[2021-09-09 02:04:07 +0000] [16177] [INFO] Reason: Worker failed to boot.

这个是存在logs文件夹中gunicorn.log文件中的,其余两个为空

@staugur
Copy link
Member

staugur commented Sep 9, 2021

猜测是依赖模块版本号问题,你执行看看什么版本:
pip show gunicorn gevent psutil

@Zynismus16
Copy link
Author

Name: gunicorn
Version: 19.10.0
Summary: WSGI HTTP Server for UNIX
Home-page: http://gunicorn.org
Author: Benoit Chesneau
Author-email: benoitc@e-engura.com
License: MIT
Location: /usr/local/lib/python2.7/dist-packages
Requires: 
---
Name: gevent
Version: 21.8.0
Summary: Coroutine-based network library
Home-page: http://www.gevent.org/
Author: Denis Bilenko
Author-email: denis.bilenko@gmail.com
License: MIT
Location: /usr/local/lib/python2.7/dist-packages
Requires: zope.interface, psutil, setuptools, zope.event, psutil, greenlet, psutil

@staugur
Copy link
Member

staugur commented Sep 9, 2021 via email

@sapicd sapicd deleted a comment from Zynismus16 Sep 9, 2021
@staugur staugur added the help wanted Extra attention is needed label Sep 9, 2021
@staugur
Copy link
Member

staugur commented Sep 9, 2021

很遗憾,我用 ubuntu18.04 python2.7 sapic1.13.2 在 virtualenv新建的虚拟环境上没有复现,正常运行。

我注意到psutil,实际上没用到它,gevent基础依赖没有它,是扩展依赖monitor、recommended中有使用(gevent/setup.py

建议使用虚拟环境测试下。

如果仍需帮助,可能需要提供如下信息:

pip list|grep -iE "gunicorn|gevent|greenlet|psutil" ; python -V ; python -c "import platform;print(platform.python_implementation(),platform.machine())"

@staugur staugur closed this as completed Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Development

No branches or pull requests

2 participants