• 请不要在回答技术问题时复制粘贴 AI 生成的内容
eycfsjd
V2EX  ›  程序员

phantomjs 卡住, cpu 100%

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