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

Compatibility with Puma master branch #31

Closed
adamlogic opened this issue May 7, 2020 · 5 comments
Closed

Compatibility with Puma master branch #31

adamlogic opened this issue May 7, 2020 · 5 comments

Comments

@adamlogic
Copy link

I just attempted to use Puma master, and requests were failing with the following:

/app/vendor/ruby-2.6.5/lib/ruby/2.6.0/json/common.rb:156:in `initialize': no implicit conversion of Hash into String (TypeError)
	from /app/vendor/ruby-2.6.5/lib/ruby/2.6.0/json/common.rb:156:in `new'
	from /app/vendor/ruby-2.6.5/lib/ruby/2.6.0/json/common.rb:156:in `parse'
	from /app/vendor/bundle/ruby/2.6.0/gems/multi_json-1.14.1/lib/multi_json/adapters/json_common.rb:14:in `load'
	from /app/vendor/bundle/ruby/2.6.0/gems/multi_json-1.14.1/lib/multi_json/adapter.rb:21:in `load'
	from /app/vendor/bundle/ruby/2.6.0/gems/multi_json-1.14.1/lib/multi_json.rb:122:in `load'
	from /app/vendor/bundle/ruby/2.6.0/gems/barnes-0.0.8/lib/barnes/instruments/puma_instrument.rb:24:in `json_stats'
	from /app/vendor/bundle/ruby/2.6.0/gems/barnes-0.0.8/lib/barnes/instruments/puma_instrument.rb:36:in `instrument!'
	from /app/vendor/bundle/ruby/2.6.0/gems/barnes-0.0.8/lib/barnes/panel.rb:46:in `block in instrument!'
	from /app/vendor/bundle/ruby/2.6.0/gems/barnes-0.0.8/lib/barnes/panel.rb:45:in `each'
	from /app/vendor/bundle/ruby/2.6.0/gems/barnes-0.0.8/lib/barnes/panel.rb:45:in `instrument!'
	from /app/vendor/bundle/ruby/2.6.0/gems/barnes-0.0.8/lib/barnes/periodic.rb:58:in `block (3 levels) in initialize'
	from /app/vendor/bundle/ruby/2.6.0/gems/barnes-0.0.8/lib/barnes/periodic.rb:57:in `each'
	from /app/vendor/bundle/ruby/2.6.0/gems/barnes-0.0.8/lib/barnes/periodic.rb:57:in `block (2 levels) in initialize'
	from /app/vendor/bundle/ruby/2.6.0/gems/barnes-0.0.8/lib/barnes/periodic.rb:46:in `loop'
	from /app/vendor/bundle/ruby/2.6.0/gems/barnes-0.0.8/lib/barnes/periodic.rb:46:in `block in initialize'Exception

In puma/puma#2086, Puma.stats was changed to return a Hash instead of a String. I'm assuming this line needs to be updated to support that.

MultiJson.load(::Puma.stats || "{}")

@nateberkopec
Copy link

Puma 5.0 will return a hash here, so I think you should just only attempt JSON conversion if Puma.stats is a String.

@schneems
Copy link

schneems commented May 7, 2020

Can we have it give a different API? Maybe Puma.stats_hash ?

@nateberkopec
Copy link

I think we had a strong case to change it. Exposing a string is not extensible by external consumers, which is what this API is intended for. A hash is a much better object for this purpose.

@schneems
Copy link

schneems commented May 8, 2020

A proposal in puma/puma#2253 to expose this as a hash without breaking backward compat.

@schneems
Copy link

This is resolved

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.

3 participants