Closed pirj closed 2 weeks ago
2.7 is broken with a uninitialized constant Gem
apparently causing Puma not to get loaded.
Which is confusing, as it seems to load rack/handler/puma, but the Rack::Handler is not loaded. In Puma 5, that file was loading rack/handler and defined Rack::Handler::Puma, but in 6.x this happens only if Rackup is not loaded. But the comment says that rackup was removed from rack 3, and evidently we install rack 3.
I’ve merged this as it fixes Ruby 3.x builds with Rails 7.1. Ruby 2.7 with Rails 7.1 runs into a different issue, which I hope to look into next.
In both cases, for 2.7 and for 3.x with Rails 7.1, we bundle puma 6.4.2 and also rackup 2.1.0. This means, Rack::Handler::Puma should not be defined. Unless there’s some race condition/load order dependency and we: 1) load rack/handler 2) load puma’s rack/handler/puma 3) (optionally) load rackup. Where does the rackup dependency even come from?
The uninitialized constant Gem (NameError)
can be caused by module Gem::Deprecate
that was later changed into a nested declaration. But this change is 11 years old, why it’s not in rubygems 3.5.9 or 3.4.22 that are recent? 🤔
It appeared in 3.5.10 in this PR.
Apparently, the namespace definition was collapsed here more than a decade ago.
I hope this is just a warning with no consequences.
What’s interesting is that in another file there's similar code, but it suggests that rack > 3 must be used with rackup gem. This whole problem seems due to rack::handler not being loaded when capybara registers its puma server, and puma registers itself as a rack handler. Wondering, what makes a difference between 2.7 and 3.x?
The problem is capybara fixed this in 3.40.0
but also pinned the base ruby version to 3.0
Rails 7.1 is unaware of the new API and this crashes our CI, eg https://github.com/rspec/rspec-rails/actions/runs/9552072568/job/26328604445?pr=2765