V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
guoguobaba
V2EX  ›  Python

selenium 爬虫会产生僵尸进程

  •  
  •   guoguobaba · Sep 8, 2023 · 1907 views
    This topic created in 971 days ago, the information mentioned may be changed or developed.
    用 django 写了一个爬虫的服务,每执行一次就产生两个僵尸进程,需要定时重启 django 才行,如何解决

    已经调用过 driver.close() driver.quite() 了

    搜了一下网上很多这种问题,但是没有解决方案

    1 ? 00:00:00 python
    7 ? 00:00:03 python
    19 ? 00:00:00 firefox-esr <defunct>
    266 ? 00:00:00 firefox-esr <defunct>
    2 replies    2023-09-08 11:51:29 +08:00
    fatbear
        1
    fatbear  
       Sep 8, 2023
    看你的进程号 是在 docker 内跑的吗, 如果是在 docker 内跑的,需要加--init 的参数,或者用 bash 套一层,在 bash 里面在调 python 执行脚本
    guoguobaba
        2
    guoguobaba  
    OP
       Sep 8, 2023
    @fatbear 谢谢,k8s 里,dockerfile 加了
    ENTRYPOINT ["/usr/bin/tini", "--"]
    就 ok 了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3167 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 14:31 · PVG 22:31 · LAX 07:31 · JFK 10:31
    ♥ Do have faith in what you're doing.