“Failed to decode response from marionette” message in Python/Firefox headless scraping script

前端 未结 7 2069
既然无缘
既然无缘 2020-12-03 03:29

Good Day, I\'ve done a number of searches on here and google and yet to find a solution that address this problem.

The scenario is:

I have a Python script (

7条回答
  •  日久生厌
    2020-12-03 03:43

    This error message...

    Message: failed to decode response from marionette
    

    ...implies that the communication between GeckoDriver and Marionette was interrupted/broken.


    Some of the reasons and solution for this issue are as follows:

    • In the discussion Crash during command execution results in "Internal Server Error: Failed to decode response from marionette" @whimboo mentions, while executing your tests Selenium may force a crash of the parent process of Firefox with an error as:

      DEBUG   <- 500 Internal Server Error {"value":{"error":"unknown error","message":"Failed to decode response from marionette","stacktrace":...}...}
      
      • Analysis: The current message is somewhat misleading and Geckdriver needs to handle this situation and reporting that the application has unexpectedly quit, in a better way. This issue is still open.
    • In the discussion Failed to decode response from marionette with Firefox >= 65 @rafagonc mentioned, this issue can occur when using GeckoDriver / FirefoxDriver or ChromeDriver in docker environment, due to presence of Zombie process that hangs even after invoking driver.quit(). At times, when you open many browsing instances one after another, your system may run out of memory or out of PIDs. See: Selenium using too much RAM with Firefox

      • As a solution @andreastt mentions, the following configuration should resolve the out of memory issue with Docker:

        --memory 1024mb --shm-size 2g
        

    Steps: Configure SHM size in the docker container

    • Similarly, while executing your test in your localhost, it is advisable to keep the following (minimum) configuration:

      --memory 1024mb
      

    Additional Considerations

    This issue can also occur due to incompatibility between the version of the binaries you are using.

    Solution:

    • Upgrade JDK to recent levels JDK 8u341.
    • Upgrade Selenium to current levels Version 3.141.59.
    • Upgrade GeckoDriver to GeckoDriver v0.26.0 level.
    • Upgrade Firefox version to Firefox v72.0 levels.
    • Execute your Test as a non-root user.

    GeckoDriver, Selenium and Firefox Browser compatibility chart


    tl; dr

    [e10s] Crash in libyuv::ARGBSetRow_X86


    Reference

    You can find a relevant detailed discussion in:

    • Browsing context has been discarded using GeckoDriver Firefox through Selenium

提交回复
热议问题