title: Unable to kill Chrome process and running out of memory with ChromeDriver and Chrome through Selenium in Python
body: <p>I have a crawling process that kicks off selenium in a custom class that looks like this:</p>
  
  <pre><code>class BrowserInterface:
  
  def __init__(self, base_url, proxy_settings):
  
      self.base_url = base_url
  
      self.display = Display(visible=0, size=(1024, 768))
      self.display.start()
  
      proxy_argument = '--proxy-server={0}'.format(PROXY_URL.format(
          proxy_settings.get('proxy_host'),
          proxy_settings.get('proxy_port')
      ))
  
      logger.debug(proxy_argument)
  
      options = webdriver.ChromeOptions()
      options.add_argument('--no-sandbox')
      options.add_argument(proxy_argument)
  
      selenium_chrome_driver_path = os.path.join(settings.DEFAULT_DRIVER_PATH,
                                                 settings.CHROME_DRIVERS[settings.CURRENT_OS])
  
      self.driver = webdriver.Chrome(executable_path=selenium_chrome_driver_path, chrome_options=options)
  
  def visit(self, url):
      url = urljoin(self.base_url, url)
      self.driver.get(url)
  
  def body(self):
      soup = BeautifulSoup(self.driver.page_source)
      return soup.find("body").text
  
  def quit(self):
      self.driver.quit()
      self.display.stop()
  </code></pre>
  
  <p>This BrowserInterface class is initialized in a batch queue and the quit() method is called at the end of the batch. There are no issues starting chrome and getting the data. The trouble is, at the end of each job when the quit() method is called chrome goes into zombie mode. When the next BrowserInterface is initialized it starts a new chrome instance. Due to this, the box is running out of memory. I've tried running the a kill command as well on the chrome process but it stays running. Any direction would be greatly appreciated as I'm about to pull my hair out over this.</p>
  
  <p>Running on Ubuntu 18.04, Google Chrome 70.0.3538.110, ChromeDriver 2.44, Python3.6.6</p>
  
  <p>Thanks in advance!</p>