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

Undefined constant Puma::HAS_NATIVE_IO_WAIT when running gemstash authorize #361

Closed
ktreis opened this issue Sep 13, 2023 · 2 comments · Fixed by #362
Closed

Undefined constant Puma::HAS_NATIVE_IO_WAIT when running gemstash authorize #361

ktreis opened this issue Sep 13, 2023 · 2 comments · Fixed by #362

Comments

@ktreis
Copy link

ktreis commented Sep 13, 2023

My Gemstash 2.3.1 server works fine with Puma 6.3.1 under Ruby 2.7, but gemstash authorize fails with the following error:

	22: from /usr/local/bundle/bin/gemstash:25:in `<main>'
	21: from /usr/local/bundle/bin/gemstash:25:in `load'
	20: from /usr/local/bundle/gems/gemstash-2.3.1/exe/gemstash:6:in `<top (required)>'
	19: from /usr/local/bundle/gems/gemstash-2.3.1/lib/gemstash/cli.rb:34:in `start'
	18: from /usr/local/bundle/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
	17: from /usr/local/bundle/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
	16: from /usr/local/bundle/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
	15: from /usr/local/bundle/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
	14: from /usr/local/bundle/gems/gemstash-2.3.1/lib/gemstash/cli.rb:59:in `authorize'
	13: from /usr/local/bundle/gems/gemstash-2.3.1/lib/gemstash/cli/authorize.rb:12:in `run'
	12: from /usr/local/bundle/gems/gemstash-2.3.1/lib/gemstash/cli/base.rb:22:in `prepare'
	11: from /usr/local/bundle/gems/gemstash-2.3.1/lib/gemstash/cli/base.rb:41:in `check_gemstash_version'
	10: from /usr/local/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:86:in `require'
	 9: from /usr/local/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:86:in `require'
	 8: from /usr/local/bundle/gems/gemstash-2.3.1/lib/gemstash/storage.rb:9:in `<top (required)>'
	 7: from /usr/local/bundle/gems/gemstash-2.3.1/lib/gemstash/storage.rb:93:in `<module:Gemstash>'
	 6: from /usr/local/bundle/gems/gemstash-2.3.1/lib/gemstash/storage.rb:95:in `<class:Resource>'
	 5: from /usr/local/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:86:in `require'
	 4: from /usr/local/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:86:in `require'
	 3: from /usr/local/bundle/gems/gemstash-2.3.1/lib/gemstash/logging.rb:6:in `<top (required)>'
	 2: from /usr/local/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:86:in `require'
	 1: from /usr/local/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:86:in `require'
/usr/local/bundle/gems/puma-6.3.1/lib/puma/log_writer.rb:6:in `<top (required)>': uninitialized constant Puma::HAS_NATIVE_IO_WAIT (NameError)

I thin the problem is in the way Gemstash detects whether it's on Puma 6, via this code:

require "puma/log_writer" # Puma 6

Looking at the Puma sources, it doesn't appear that this file is intended to be loaded independently; it expects the HAS_NATIVE_IO_WAIT constant to be defined before this code is loaded:

https://github.com/puma/puma/blob/04b8b09ad20ace1a3a5cfe06375dc24818697d19/lib/puma/log_writer.rb#L6

... which would mean that we'd at least need to require puma/detect before attempting to loading puma/log_writer. Or perhaps there's a better way to detect Puma 6?

@ktreis
Copy link
Author

ktreis commented Sep 13, 2023

Confirmed, loading puma/detect before puma/log_writer appears to fix this issue.

olleolleolle added a commit to olleolleolle/gemstash that referenced this issue Sep 14, 2023
Load puma/detect.rb to allow puma/log_writer.rb to work.

Fixes rubygems#361 - thank you, ktreis!
olleolleolle added a commit that referenced this issue Sep 14, 2023
Load puma/detect.rb to allow puma/log_writer.rb to work.

Fixes #361 - thank you, ktreis!
@olleolleolle
Copy link
Member

@ktreis When you have the time, v2.3.2 should have that change in it.

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

Successfully merging a pull request may close this issue.

2 participants