1

When dealing with some memory issues, my script was interrupted and now it will not restart. I am getting an error "selenium.common.exceptions.SessionNotCreatedException: Message: session not created from tab crashed (Session info: headless chrome=84.0.4147.135)"

I read a few other similar questions (this one is almost identical), but the solutions do not resolve my problem.

Here is my code:

from selenium import webdriver

chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument("--headless")
chromeOptions.add_argument("--remote-debugging-port=9222")
chromeOptions.add_argument('--no-sandbox')
chromeOptions.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US',
                        "download.default_directory": download_location,
                        "download.directory_upgrade": True})
webdriver_location = '/usr/bin/chromedriver'

driver = webdriver.Chrome(webdriver_location,options=chromeOptions)

I attempted to add the chromeOptions.add_argument('--disable-dev-shm-usage') and received the same error.

Because the setup was running perfectly moments before and no updates have been done, I do not believe any versioning is the problem. I'm running on a Centos 7 server. I originally received the error with Google Chrome 84 and Chromedriver 84. Same error occurs when upgrading both to 85.

Here is the full error:

   Traceback (most recent call last):
  File "server_scraper_javascript_v2.py", line 323, in <module>
    driver = webdriver.Chrome(webdriver_location,options=chromeOptions)
  File "/home/education01/scraper/env/lib64/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
    RemoteWebDriver.__init__(
  File "/home/education01/scraper/env/lib64/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/education01/scraper/env/lib64/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/education01/scraper/env/lib64/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/education01/scraper/env/lib64/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created
from tab crashed
  (Session info: headless chrome=84.0.4147.135)

UPDATE: I do not have experience using Chromium without Selenium and a webdriver, but if I run chrome --headless --disable-gpu --dump-dom https://www.chromestatus.com/, it fails and I receive this:

#
# Fatal error in , line 0
# Fatal process out of memory: Failed to reserve memory for new V8 Isolate
#
#
#
#FailureMessage Object: 0x7ffc0fc7ed50#0 0x5619c34ebdd9 <unknown>
--2020-08-27 10:20:27--  https://clients2.google.com/cr/report
Resolving clients2.google.com (clients2.google.com)... 172.217.165.142, 2607:f8b0:4006:808::200e
Connecting to clients2.google.com (clients2.google.com)|172.217.165.142|:443... connected.
HTTP request sent, awaiting response... [0827/102028.181052:ERROR:headless_shell.cc(391)] Abnormal renderer termination.
200 OK
Length: unspecified [text/plain]
Saving to: ‘/dev/fd/4’


     0K Crash dump id:   80939f7cd5646339 
Dale W.
  • 51
  • 5
  • Have you tried using [version 85](https://chromedriver.chromium.org/downloads) of Chrome driver? – Marek Piotrowski Aug 26 '20 at 19:53
  • @MarekPiotrowski Yes, I did and produced the same error. I wouldn't have thought to upgrade simply because it had been working consistently previously, but the update did not help. – Dale W. Aug 27 '20 at 09:12
  • And you can open Chromium and navigate with no problems manually? – Marek Piotrowski Aug 27 '20 at 09:16
  • I do not have any GUI set up and have never used Chromium without a webdriver and Selenium so I am not sure the best way to test. If I run `google-chrome --headless --disable-gpu --dump-dom https://www.chromestatus.com/`, it does fail. I get "Fatal error in , line 0 # Fatal process out of memory: Failed to reserve memory for new V8 Isolate." I will add this to the question. – Dale W. Aug 27 '20 at 14:22
  • Change your ulimits then: https://access.redhat.com/solutions/61334 – Marek Piotrowski Aug 27 '20 at 14:25
  • Changed them to unlimited but still getting the same error. – Dale W. Aug 27 '20 at 15:48

1 Answers1

2

I recently ran into this issue where a script I call regularly was working, and then failed with the same "session not created from tab" error. I hadn't updated chrome or the chromedriver so the other solutions I found didn't work. I found that the issue was that I wasn't quitting the browsers at the end of my script so they were all still active.

I checked the active pid's for chrome with pgrep chrome and saw that I had a bunch of chrome processes running. I killed them all with pkill chrome and that fixed the issue. I added driver.quit() to the end of the script to kill the browser when it's done.

I'm not sure if that will solve your issue, but the memory error you got when trying to run google-chrome --headless made me think it might be the same issue I had.

javery1289
  • 67
  • 7