capybara icon indicating copy to clipboard operation
capybara copied to clipboard

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

Open dolzenko opened this issue 9 months ago • 0 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] https://github.com/teamcapybara/capybara/compare/master...dolzenko:capybara:patch-2

dolzenko avatar Apr 30 '24 08:04 dolzenko