[求助] Python 调用 phantomjs 老是因为 Out of memory 被 kill - V2EX
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
goodryb
V2EX    Python

[求助] Python 调用 phantomjs 老是因为 Out of memory 被 kill

  •  
  •   goodryb 2017-12-01 11:32:01 +08:00 3396 次点击
    这是一个创建于 2878 天前的主题,其中的信息可能已经有所发展或是发生改变。
    第 1 条附言    2017-12-06 16:14:53 +08:00
    切换到 chrome headless 后就没问题了,内存占用很小

    确认是 phantomjs 的锅
    12 条回复    2017-12-01 20:35:01 +08:00
    janxin
        1
    janxin  
       2017-12-01 11:41:15 +08:00
    内存太小了?
    goodryb
        2
    goodryb  
    OP
       2017-12-01 11:44:16 +08:00
    @janxin #1 1.6G 不算小吧,程序启动了可以运行几个小时,内存一直增加,然后就被 kill 了
    neoblackcap
        3
    neoblackcap  
       2017-12-01 11:45:05 +08:00
    phantomjs OOM 很正常,用 chrome headless mode。作者都是这样说
    wzwwzw
        4
    wzwwzw  
       2017-12-01 13:01:16 +08:00
    为什么不用 chrome headless 呢。
    hahastudio
        5
    hahastudio  
       2017-12-01 13:05:20 +08:00
    一定要用 phantomjs 的话,可以爬几个页面重启一下 phantomjs
    holyghost
        6
    holyghost  
       2017-12-01 13:09:00 +08:00
    我已经换到 chrome headless 了
    a7a2
        7
    a7a2  
       2017-12-01 13:25:07 +08:00
    建议使用 chromedriver,phantomjs 就很容易被识别。。。
    goodryb
        8
    goodryb  
    OP
       2017-12-01 15:07:46 +08:00
    @neoblackcap #3
    @wzwwzw #4
    @holyghost #6
    @a7a2 #7

    好吧,看来我用到的工具落后了,已经更换到了 chrome headless,今天跑一跑,看看情况


    @hahastudio #5 这个有点麻烦,解决方法不是太优雅
    gouchaoer
        9
    gouchaoer  
       2017-12-01 15:17:02 +08:00
    新的就用 chrome headless,老的懒得切就继续 phantomjs 咯
    Tunar
        10
    Tunar  
       2017-12-01 15:48:01 +08:00 via Android
    作者不是溜了么。。
    BiggerLonger
        11
    BiggerLonger  
       2017-12-01 16:17:16 +08:00
    chrome 有像 phantomjs 那的 web server 模吧?
    goodryb
        12
    goodryb  
    OP
       2017-12-01 20:35:01 +08:00
    @gouchaoer #9 个人用,所以切换比较方便

    @Tunar #10 不太清楚呢

    @BiggerLonger #11 我感觉两种方式差不多,chrome 需要一个额外的 chromedriver
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     895 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 35ms UTC 21:39 PVG 05:39 LAX 14:39 JFK 17:39
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86