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.
Simple repro Rails 7 app attached [1]. The idea is that after doing
the process never finishes after printing
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