V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
eycfsjd
V2EX  ›  程序员

phantomjs 卡住, cpu 100%

  •  
  •   eycfsjd · Aug 3, 2016 · 5237 views
    This topic created in 3559 days ago, the information mentioned may be changed or developed.

    执行如下命令,发现卡住了,而且一个线程把 cpu 搞到 100%了,除了 kill 有啥方法解决这个问题?

    render_multi_url.js 在 examples 包里

    bin/phantomjs --debug=true render_multi_url.js "www.tlnews.cn/forum/forumdisplay.php?fid=54573"
    
    8 replies    2016-08-04 11:40:51 +08:00
    zhouyg
        1
    zhouyg  
       Aug 3, 2016
    那个 render_multi_url.js 是啥
    bdbai
        2
    bdbai  
       Aug 3, 2016 via Android
    为什么不直接发请求呢
    eycfsjd
        3
    eycfsjd  
    OP
       Aug 3, 2016
    我需要保存页面 截图
    TaMud
        4
    TaMud  
       Aug 4, 2016
    page.onError = function(msg, trace) {
    var msgStack = ['ERROR: ' + msg];
    console.error(msgStack.join('\n'));
    phantom.exit();
    };
    eycfsjd
        5
    eycfsjd  
    OP
       Aug 4, 2016
    @TaMud 这个不起作用,这儿没有 error 事件,具体请看 https://github.com/ariya/phantomjs/issues/14444
    willis
        6
    willis  
       Aug 4, 2016   ❤️ 1
    timeout 10 phantomjs --debug=true render_multi_url.js "www.tlnews.cn/forum/forumdisplay.php?fid=54573"
    willis
        7
    willis  
       Aug 4, 2016
    timeout 命令有些发行版要自己装
    willis
        8
    willis  
       Aug 4, 2016
    还有可以用 nice 命令调整 cpu 优先级,要 root
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2338 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 01:38 · PVG 09:38 · LAX 18:38 · JFK 21:38
    ♥ Do have faith in what you're doing.