teamcapybara / capybara

Acceptance test framework for web applications
http://teamcapybara.github.io/capybara/
MIT License
9.98k stars 1.44k forks source link

Chrome headless tests failing after updating to 3.40.0 #2742

Closed taylor-steve closed 4 months ago

taylor-steve commented 4 months ago

Meta

Capybara Version: 3.40.0 Driver Information (and browser if relevant): selenium-webdriver (4.17.0)

After switching to Capybara 3.40.0 on https://github.com/sul-dlss/sul-embed and when using :selenium_chrome_headless we're getting an initial failure which causes subsequent tests to fail (locally and on CI):

Failures:

  1) embed this panel embed code includes height and width attributes
     Failure/Error: Unable to infer file and line number from backtrace

     Selenium::WebDriver::Error::UnknownError:
       unknown error: session deleted because of page crash
       from unknown error: cannot determine loading status
       from tab crashed
         (Session info: chrome=121.0.6167.139)
     # 0   chromedriver                        0x00000001013a67dc chromedriver + 4040668
     # 1   chromedriver                        0x000000010139e9e0 chromedriver + 4008416
     # 2   chromedriver                        0x00000001010116a8 chromedriver + 284328
     # 3   chromedriver                        0x0000000100ffbeb0 chromedriver + 196272
     # 4   chromedriver                        0x0000000100ffb708 chromedriver + 194312
     # 5   chromedriver                        0x0000000100ffaac0 chromedriver + 191168
     # 6   chromedriver                        0x0000000100ffaa6c chromedriver + 191084
     # 7   chromedriver                        0x0000000100ff9108 chromedriver + 184584
     # 8   chromedriver                        0x0000000100ff9c60 chromedriver + 187488
     # 9   chromedriver                        0x00000001010085a0 chromedriver + 247200
     # 10  chromedriver                        0x000000010101c1a4 chromedriver + 328100
     # 11  chromedriver                        0x0000000100ffa220 chromedriver + 188960
     # 12  chromedriver                        0x000000010101be00 chromedriver + 327168
     # 13  chromedriver                        0x000000010108ef8c chromedriver + 798604
     # 14  chromedriver                        0x000000010104974c chromedriver + 513868
     # 15  chromedriver                        0x000000010104a044 chromedriver + 516164
     # 16  chromedriver                        0x000000010136ba04 chromedriver + 3799556
     # 17  chromedriver                        0x000000010136fee4 chromedriver + 3817188
     # 18  chromedriver                        0x0000000101354260 chromedriver + 3703392
     # 19  chromedriver                        0x0000000101370a2c chromedriver + 3820076
     # 20  chromedriver                        0x000000010134701c chromedriver + 3649564
     # 21  chromedriver                        0x000000010138de3c chromedriver + 3939900
     # 22  chromedriver                        0x000000010138dfb4 chromedriver + 3940276
     # 23  chromedriver                        0x000000010139e660 chromedriver + 4007520
     # 24  libsystem_pthread.dylib             0x00000001851e2034 _pthread_start + 136
     # 25  libsystem_pthread.dylib             0x00000001851dce3c thread_start + 8

That's from https://github.com/sul-dlss/sul-embed/blob/main/spec/features/metrics_spec.rb

After registering a new driver, with the '--headless=old' option, tests pass again.

I'm assuming this means this is not a Capybara problem, but I'm hoping you could:

Thanks, I appreciate it.

JIucToyxuu commented 4 months ago

We have similar issue(cannot determine loading status from tab crashed) but with 3.39.2 version. Issue appeared between 19-23 Jan 2024. We use docker and did not any changes to launch process of Capybara. We start use '--headless=new' option some time ago and it was works.

Some time ago we was have similar issue. It was fixed by use option '--disable-dev-shm-usage'. Issue details(not my but same): https://github.com/elgalu/docker-selenium/issues/20

taylor-steve commented 4 months ago

Looks like removing --disable-site-isolation-trials from the default Capybara driver definition fixes our issues for this particular set of tests.

--disable-dev-shm-usage seems like it could be helpful in some other situations I'm seeing, I will try that.

Thanks for your help!

jcoyne commented 4 months ago

@twalpole does it make sense to remove the --disable-site-isolation-trials from the default driver give that this seems to be a source of problems?

twalpole commented 4 months ago

I don't think so --- the fact that it fixed one users problem doesn't mean that it's unnecessary for others --- There are so many chrome options which are necessary in varying environments that if you have one of those environments, especially CI environments, you will need to customize your own driver config. What's provided by default works for most people running locally

JIucToyxuu commented 3 months ago

Looks like it was memory leak in Chrome. It should be fixed in v122. At least it works for us.