I have a multiprocess program that creates new instances of chrome web driver, but after a while I see the number of chrome processes gets very high (2300!!) :
opt/google/chrome/chrome --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-infobars --disable-popup-blocking --disable-prompt-on-repost
I tried to kill any chrome process which are still alive after quitting the driver using this code:
mydisplay = Display(visible=0, size=(1024, 768))
mydisplay.start()
mydriver = webdriver.Chrome('driver path')
PIDs = psutil.Process(mydriver.service.process.pid).children(recursive=True)
self.driver.quit()
self.display.stop()
for p in PIDs:
try:
p.kill()
except:
print 'no process to kill'
But when it runs, there still some 'chrome' processes left behind. Any idea of the root cause of the problem and how to resolve it?