Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padrino (v. 0.15.3) fails to start with Ruby 3.3.0: uninitialized constant Padrino::Rackup (NameError) #2288

Open
kimberlykeilymh opened this issue Apr 20, 2024 · 26 comments

Comments

@kimberlykeilymh
Copy link

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Failure to start server using Ruby 3.3.0. Below is the stack trace.

$ bundle exec padrino s
bundler: failed to load command: padrino (/home/kimberly/.gem/ruby/3.3.0/bin/padrino)
/home/kimberly/.gem/ruby/3.3.0/bundler/gems/padrino-framework-d75858b05d9c/padrino-core/lib/padrino-core/server.rb:33:in `<module:Padrino>': uninitialized constant Padrino::Rackup (NameError)

  class Server < Rackup::Server
                 ^^^^^^
	from /home/kimberly/.gem/ruby/3.3.0/bundler/gems/padrino-framework-d75858b05d9c/padrino-core/lib/padrino-core/server.rb:1:in `<top (required)>'
	from /home/kimberly/.rubies/ruby-3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /home/kimberly/.rubies/ruby-3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /home/kimberly/.gem/ruby/3.3.0/bundler/gems/padrino-framework-d75858b05d9c/padrino-core/lib/padrino-core.rb:15:in `<top (required)>'
	from /home/kimberly/.rubies/ruby-3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /home/kimberly/.rubies/ruby-3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /home/kimberly/.gem/ruby/3.3.0/bundler/gems/padrino-framework-d75858b05d9c/padrino/lib/padrino.rb:3:in `<top (required)>'
	from <internal:/home/kimberly/.rubies/ruby-3.3.0/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from <internal:/home/kimberly/.rubies/ruby-3.3.0/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from /home/kimberly/.rubies/ruby-3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/runtime.rb:55:in `each'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/runtime.rb:55:in `block in require'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/runtime.rb:44:in `each'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/runtime.rb:44:in `require'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler.rb:187:in `require'
	from /home/kimberly/.rubies/ruby-3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /home/kimberly/.rubies/ruby-3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /home/kimberly/.gem/ruby/3.3.0/bundler/gems/padrino-framework-d75858b05d9c/padrino-core/lib/padrino-core/cli/launcher.rb:25:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
	from /home/kimberly/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /home/kimberly/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
	from /home/kimberly/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor/base.rb:584:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/bundler/gems/padrino-framework-d75858b05d9c/padrino-core/bin/padrino:9:in `<top (required)>'
	from /home/kimberly/.gem/ruby/3.3.0/bin/padrino:25:in `load'
	from /home/kimberly/.gem/ruby/3.3.0/bin/padrino:25:in `<top (required)>'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/cli/exec.rb:58:in `load'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/cli/exec.rb:23:in `run'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/cli.rb:451:in `exec'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/cli.rb:34:in `dispatch'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/cli.rb:28:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/exe/bundle:28:in `block in <top (required)>'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/exe/bundle:20:in `<top (required)>'
	from /home/kimberly/.rubies/ruby-3.3.0/bin/bundle:25:in `load'
	from /home/kimberly/.rubies/ruby-3.3.0/bin/bundle:25:in `<main>'

What is the expected behavior?

Start the server without errors.

Which versions of Ruby, Padrino, Sinatra, Rack, OS are you using? Did this work in previous versions?

Ruby 3.3.0, Padrino 0.15.3, Ubuntu 23.10.

@nesquena
Copy link
Member

@achiurizo would this be fixed with a release from master? Would be great to cut a release that supports Ruby 3.3

@kimberlykeilymh
Copy link
Author

kimberlykeilymh commented Apr 22, 2024

Something to mention is that I am using the git repository as a source code, I mean, in my Gemfle it is as follows: gem 'padrino', git: 'https://github.com/padrino/padrino-framework'

@achiurizo
Copy link
Member

@kimberlykeilymh thank you for the report! I've pushed out #2289 which should resolve this (adds rackup). If you want to test this sooner, you can try using the branch directly until its merged:

gem 'padrino', git: 'https://github.com/padrino/padrino-framework', branch: 'achiurizo/add-rackup-to-gemspec'

@nesquena we should do more testing after #2289 but after that I think we can go ahead and cut a release

@nesquena
Copy link
Member

I went ahead and merged that change. Let us know if that fixes things for you. If everything is working as expected, we can do final testing and cut a release

@kimberlykeilymh
Copy link
Author

Thanks guys! The change fixed the bug with rackup.

Although now I get this other error:

bundler: failed to load command: padrino (/home/kimberly/.gem/ruby/3.3.0/bin/padrino)
/home/kimberly/.gem/ruby/3.3.0/bundler/gems/padrino-framework-889f6623c071/padrino-core/lib/padrino-core/server.rb:24:in `detect_application': undefined method `merge' for nil (NoMethodError)

      [rack_app, rack_options.merge(options)]
                             ^^^^^^
	from /home/kimberly/.gem/ruby/3.3.0/bundler/gems/padrino-framework-889f6623c071/padrino-core/lib/padrino-core/server.rb:12:in `run!'
	from /home/kimberly/.gem/ruby/3.3.0/bundler/gems/padrino-framework-889f6623c071/padrino-core/lib/padrino-core/cli/adapter.rb:9:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/bundler/gems/padrino-framework-889f6623c071/padrino-core/lib/padrino-core/cli/launcher.rb:30:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
	from /home/kimberly/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /home/kimberly/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
	from /home/kimberly/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor/base.rb:584:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/bundler/gems/padrino-framework-889f6623c071/padrino-core/bin/padrino:9:in `<top (required)>'
	from /home/kimberly/.gem/ruby/3.3.0/bin/padrino:25:in `load'
	from /home/kimberly/.gem/ruby/3.3.0/bin/padrino:25:in `<top (required)>'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/cli/exec.rb:58:in `load'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/cli/exec.rb:23:in `run'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/cli.rb:451:in `exec'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/cli.rb:34:in `dispatch'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/cli.rb:28:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/exe/bundle:28:in `block in <top (required)>'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.9/exe/bundle:20:in `<top (required)>'
	from /home/kimberly/.gem/ruby/3.3.0/bin/bundle:25:in `load'
	from /home/kimberly/.gem/ruby/3.3.0/bin/bundle:25:in `<main>'

Is it also possible to check this error? I can open another issue and close this one if you want.

@nesquena
Copy link
Member

@achiurizo hmm, looks like rack_options is nil rather than a hash now in the server start sequence

@srolandmarshall
Copy link

srolandmarshall commented Apr 30, 2024

@nesquena I built a Padrino app from scratch with limited changes to config (updating database) — using Edge release w/ the inclusion of Backup in the Gemspec results in the issue @kimberlykeilymh mentioned above.

➜  probable-pitchers-padrino git:(main) padrino start
/Users/sam-home/.rvm/gems/ruby-3.1.3/bundler/gems/padrino-framework-889f6623c071/padrino-core/lib/padrino-core/server.rb:24:in `detect_application': undefined method `merge' for nil:NilClass (NoMethodError)

      [rack_app, rack_options.merge(options)]
                             ^^^^^^
        from /Users/sam-home/.rvm/gems/ruby-3.1.3/bundler/gems/padrino-framework-889f6623c071/padrino-core/lib/padrino-core/server.rb:12:in `run!'

Prior to using the Edge release, I was using the default release and included Backup using bundler add rackup to the same issue

@nesquena
Copy link
Member

nesquena commented Apr 30, 2024

As a starting point, thanks @srolandmarshall I don't want to be too optimistic but it seems like part of this may just be a change to the way Rack parses the files. I had rack options default to {} on #2290 (branch nesquena-rack-options-fix) until achiu may have a chance to test end to end

It's possible this would fix it, but also possible and likely there's larger changes to Rack that need to be adjusted in the core server startup sequence

@srolandmarshall
Copy link

Checked it out, seemed to solve the problem on my end. Thanks for the quick patch @nesquena

@nesquena
Copy link
Member

nesquena commented Apr 30, 2024

Great, thanks for testing! @achiurizo can you merge my PR, and @kimberlykeilymh can you try my patch as well and report back either now or after we merge to master

@kimberlykeilymh
Copy link
Author

Hi guys! Yes, that solved the problem and padrino is running without errors. Thanks very much for the fix!

@nesquena
Copy link
Member

nesquena commented May 2, 2024

That's great news, thanks for testing! Since two of you confirmed, perhaps it's time to cut a new release soon

@floriandejonckheere
Copy link

Hi! Any news on a new release of Padrino?

@nesquena
Copy link
Member

I'll push out a new release with these fixes within a week

@nesquena
Copy link
Member

nesquena commented Aug 6, 2024

Okay I pushed out release 0.16.0.pre2 which appears compatible with latest Rack and Ruby - can one or two of you try this and report back confirming everything works as it should?

@floriandejonckheere @achiurizo @kimberlykeilymh @srolandmarshall

As soon as I get confirmations, I'll cut it as an official release! If anyone wants to help fix the CI to pass the tests fully, that would be appreciated as well 😅

@kimberlykeilymh
Copy link
Author

kimberlykeilymh commented Aug 7, 2024

Hi folks! Thanks for pushed out a new version!
I try the pre-release version with Ruby 3.3.0, but I got this error:

bundler: failed to load command: padrino (/home/kimberly/.gem/ruby/3.3.0/bin/padrino)
/home/kimberly/.gem/ruby/3.3.0/gems/padrino-core-0.16.0.pre2/lib/padrino-core/server.rb:86:in `detect_rack_handler': Server handler (thin, puma, spider-gazelle, mongrel, trinidad, webrick) not found. (RuntimeError)
	from /home/kimberly/.gem/ruby/3.3.0/gems/padrino-core-0.16.0.pre2/lib/padrino-core/server.rb:45:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/gems/padrino-core-0.16.0.pre2/lib/padrino-core/server.rb:12:in `run!'
	from /home/kimberly/.gem/ruby/3.3.0/gems/padrino-core-0.16.0.pre2/lib/padrino-core/cli/adapter.rb:9:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/gems/padrino-core-0.16.0.pre2/lib/padrino-core/cli/launcher.rb:30:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
	from /home/kimberly/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /home/kimberly/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
	from /home/kimberly/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor/base.rb:584:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/gems/padrino-core-0.16.0.pre2/bin/padrino:9:in `<top (required)>'
	from /home/kimberly/.gem/ruby/3.3.0/bin/padrino:25:in `load'
	from /home/kimberly/.gem/ruby/3.3.0/bin/padrino:25:in `<top (required)>'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/cli/exec.rb:58:in `load'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/cli/exec.rb:23:in `run'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/cli.rb:455:in `exec'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/cli.rb:35:in `dispatch'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/cli.rb:29:in `start'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.17/exe/bundle:28:in `block in <top (required)>'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
	from /home/kimberly/.gem/ruby/3.3.0/gems/bundler-2.5.17/exe/bundle:20:in `<top (required)>'
	from /home/kimberly/.gem/ruby/3.3.0/bin/bundle:25:in `load'
	from /home/kimberly/.gem/ruby/3.3.0/bin/bundle:25:in `<main>'

@nesquena
Copy link
Member

nesquena commented Aug 7, 2024

Based on this part of the error:

Server handler (thin, puma, spider-gazelle, mongrel, trinidad, webrick) not found.

I wonder if you could try adding the "puma" gem or thin to the Gemfile of your app, run bundle and then try starting it up again?

Does that change anything?

@kimberlykeilymh
Copy link
Author

Something I forgot to mention is that we use WEBrick as a server, which is part of the server list.

@kimberlykeilymh
Copy link
Author

Trying with Puma and thin I got the same error

@nesquena
Copy link
Member

nesquena commented Aug 7, 2024

Thanks @kimberlykeilymh for testing! I'm glad I did this as a pre release 😅

And once we figure out this issue, get all the tests passing, and confirm things are looking good, I'll push an official version

@nesquena
Copy link
Member

nesquena commented Aug 7, 2024

@achiurizo Any idea what might be going on above?

@osbre
Copy link
Contributor

osbre commented Aug 9, 2024

@nesquena I have found the cause and sent a fix: #2294

Can confirm it now works with Puma.

@nesquena
Copy link
Member

nesquena commented Aug 9, 2024

@nesquena I have found the cause and sent a fix: #2294

Can confirm it now works with Puma.

Thank you! 🙏 I'll release pre3 today with this fix so others can confirm

@nesquena
Copy link
Member

nesquena commented Aug 9, 2024

Pushed pre3

@kimberlykeilymh Can you try again with the latest pre3 release and confirm that everything works as expected now?

@kimberlykeilymh
Copy link
Author

kimberlykeilymh commented Aug 15, 2024

Hi Nathan! @nesquena
I tested the pre3 version and the error with the server no longer occurs, thank you very much for fixing it!

On the other hand, I had an error with this new version regarding the parameters received by the controller. In one of the forms we have fields nested in two levels that reach the controller in the following way:

(ruby) params
{
     "account"=>
     {
          "status"=>"active",
          "account_settings"=>
          {
               "example_field"=>"example_value"
          },
          "name"=>"Account Name"
     } 
}

But now those same parameters are obtained like this:

(ruby) params
{
     "account"=>
     {
          "status"=>"active",
          "account_settings[example_field"=>
          {
               "]"=>"example_value"
          },
          "name"=>"Account Name"
     } 
}

At the form level the name of the fields remains the same (account[account_settings[example_field]]).

This would be for example for an Account model, which is associated with an AccountSettings model which has an example_field field.

Do you have any idea what could be happening? Is there some new definition in the framework that does not allow nesting in more than one level?

Thanks in advance,

@nesquena
Copy link
Member

nesquena commented Aug 15, 2024

Thanks so much for testing @kimberlykeilymh and catching the issue with nested form parameter processing. That seems like a bug. Before we release, we'll fix this so that it matches the original behavior

If anyone can help investigate, and or write tests for this, or fix any other failing tests, that would be appreciated

Before this next major release, we'll also need to fix all failing tests and test a number of apps work as expected. But glad we are making some progress 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants