Sidekiq job getting Selenium::WebDriver::Error::UnknownError: invalid argument: can't kill an exited process (but only when run async)

1

I have a Sidekiq job that uses Capybara, deployed on a Heroku dyno. I run into the following issue even with Sidekiq concurrency=1.

When run asynchronously, the jobs sometimes return the following error:

Selenium::WebDriver::Error::UnknownError: invalid argument: can't kill an exited process

But never ever synchronously on Heroku 🤔

When I look at the Selenium debug logs, I see:

[Parent 993, Gecko_IOThread] WARNING: Failed to launch tab subprocess: file /builds/worker/workspace/build/src/ipc/glue/GeckoChildProcessHost.cpp, line 647
[Parent 993, Gecko_IOThread] WARNING: pipe error (34): Connection reset by peer: file /builds/worker/workspace/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 353
JavaScript error: chrome://global/content/bindings/remote-browser.xml, line 240: TypeError: this.frameLoader.tabParent is null
JavaScript error: chrome://global/content/bindings/remote-browser.xml, line 366: NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIScriptSecurityManager.getLoadContextCodebasePrincipal]
(firefox:993): GConf-WARNING **: 18:44:30.591: Client failed to connect to the D-BUS daemon:
Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

This thread gives a fix for a similar but ultimately different issue also involving $DISPLAY. However, I ssh'ed in and set $DISPLAY to [:0.0] to no avail.

Further Notes:

  • In this Stackoverflow post, someone suggested a version mismatch between Geckodriver and Firefox could cause can't kill an exited process. However, my versions are compatible, using latest Selenium, Firefox, and geckodriver. And yes, I'm running headless=true.
  • If relevant to the above, I also periodically get the following issues (also only while async, I can remove this if not relevant):

ThreadError: can't create Thread: Resource temporarily unavailable

Selenium::WebDriver::Error::WebDriverError: unable to connect to geckodriver 127.0.0.1:4457

Selenium::WebDriver::Error::TimeoutError: Connection refused (os error 111)

Error R14 (Memory quota exceeded)

selenium
heroku
capybara
sidekiq
geckodriver
asked on Stack Overflow Aug 2, 2020 by Rishi • edited Aug 2, 2020 by Rishi

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0