teamcapybara / capybara

Acceptance test framework for web applications

Home Page:http://teamcapybara.github.io/capybara/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Under JRuby Capybara is hanging with default server (Puma) at the end of test suite

dolzenko opened this issue · comments

Simple repro Rails 7 app attached [1]. The idea is that after doing

bin/rails test:system

the process never finishes after printing

Finished in 1.972128s, 0.5071 runs/s, 0.5071 assertions/s.
1 runs, 1 assertions, 0 failures, 1 errors, 0 skips

I firmly believe this is happening because when JRuby tries to kill/join the Puma reactor thread at shutdown [2], but being stuck in epollWait Puma thread won't die. With simple patch [3] it works on JRuby 9.3 but gives NullPointerException on 9.4 so it's just for illustration of the idea that Puma server should be probably shutdown in some specific way.

I'm also undecided if that should be reported to JRuby/Puma or here so suggestions welcome.

[1] https://github.com/dolzenko/capybara-puma-hanging-repro
[2] https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/internal/runtime/ThreadService.java#L158
[3] master...dolzenko:capybara:patch-2