当通过Selenium运行多个Firefox实例时,Geckodriver意外退出

时间:2018-02-22 18:36:44

标签: python selenium firefox selenium-webdriver geckodriver

我正在开发一个通过python Selenium运行100多个无头Firefox实例的系统。

实时实例的数量逐渐启动,每次10-20个,直到整个系统运行。

前50-60个实例没有问题。在任何时候,新实例开始失败,看似随机,硒返回以下错误消息:

Message: Service geckodriver unexpectedly exited. Status code was: 0

我正在使用selenium v3.8.1Firefox 57.0.1geckodriver 0.19.1。这一切都在Ubuntu上的AWS实例上运行。

到目前为止,我已尝试搜索selenium - 和Firefox论坛,但运气不佳。来自selenium的错误消息或状态代码导致我无处可去。

这是完整的堆栈跟踪:

Traceback (most recent call last):
  File "[..]/utils.py", line 283, in launch_browser
    client = webdriver.Firefox(firefox_options=options, log_path=log_path)
  File "[..]/.virtualenvs/user/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 148, in __init__
    self.service.start()
  File "[..]/.virtualenvs/user/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self.assert_process_still_running()
  File "[..]/.virtualenvs/user/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
    % (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service geckodriver unexpectedly exited. Status code was: 0

我还查看了我的geckodriver日志。它们非常冗长,所以我不确定哪条线与上述问题相关。让我觉得可能出现问题的一点是:

1518573330504   addons.xpi-utils    WARN    addMetadata: Add-on activity-stream@mozilla.org is invalid: [Exception... "Component returned failure code: 0x80520006 (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) [nsIFile.isFile]"  nsresult: "0x80520006 (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)"  location: "JS frame :: resource://gre/modules/addons/XPIInstall.jsm :: this.loadManifestFromFile :: line 971"  data: no] Stack trace: this.loadManifestFromFile()@resource://gre/modules/addons/XPIInstall.jsm:971 < syncLoadManifestFromFile()@resource://gre/modules/addons/XPIProvider.jsm:947 < addMetadata()@resource://gre/modules/addons/XPIProvider.jsm -> resource://gre/modules/addons/XPIProviderUtils.js:1231 < processFileChanges()@resource://gre/modules/addons/XPIProvider.jsm -> resource://gre/modules/addons/XPIProviderUtils.js:1578 < checkForChanges()@resource://gre/modules/addons/XPIProvider.jsm:3265 < startup()@resource://gre/modules/addons/XPIProvider.jsm:2182 < callProvider()@resource://gre/modules/AddonManager.jsm:263 < _startProvider()@resource://gre/modules/AddonManager.jsm:730 < startup()@resource://gre/modules/AddonManager.jsm:897 < startup()@resource://gre/modules/AddonManager.jsm:3081 < observe()@jar:file:///opt/firefox/omni.ja!/components/addonManager.js:65

编辑: 我只是在sys日志中注意到这一点: [774967.585584] firefox[66283]: segfault at 0 ip 0000000000409509 sp 00007ffffd908800 error 6 in firefox[400000+2c000]

编辑2: 以下是有关服务器规格的更多详细信息。

这是一个m4.16xlarge Amazon EC2实例类型。它承诺的规格是64个vCPU,256 GiB的RAM。

0 个答案:

没有答案