Skip to content

don't break if WEB_CONCURRENCY is set to a blank string#3837

Merged
dentarg merged 5 commits into
puma:mainfrom
jjb:patch-2
Jan 9, 2026
Merged

don't break if WEB_CONCURRENCY is set to a blank string#3837
dentarg merged 5 commits into
puma:mainfrom
jjb:patch-2

Conversation

@jjb

@jjb jjb commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

Description

Thank you for contributing! You're the best.

We can read your code, so consider leaving some comments here that are more about your motivations and decision making. Some things that may be helpful to address in your description:

  • What original problem led to this PR?
  • Are there related issues / prior discussions?
  • What alternatives have been tried? Does this supersede previous attempts?
  • Why do you make the choices you did? What are the tradeoffs?

Your checklist for this pull request

  • I have reviewed the guidelines for contributing to this repository.
  • I have added (or updated) appropriate tests if this PR fixes a bug or adds a feature.
  • My pull request is 100 lines added/removed or less so that it can be easily reviewed.
  • If this PR doesn't need tests (docs change), I added [ci skip] to the title of the PR.
  • If this closes any issues, I have added "Closes #issue" to the PR description or my commit messages.
  • I have updated the documentation accordingly.
  • All new and existing tests passed, including Rubocop.

Comment thread lib/puma/configuration.rb Outdated

@joshuay03 joshuay03 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Can you add a test for this case please? I think we have a bunch for this env var config.

@nateberkopec FYI, this might conflict with #3827

Comment thread lib/puma/configuration.rb Outdated
@github-actions github-actions Bot added the waiting-for-review Waiting on review from anyone label Dec 12, 2025
@jjb
jjb marked this pull request as draft December 13, 2025 16:41
Comment thread test/test_config.rb Outdated
@jjb

jjb commented Dec 13, 2025

Copy link
Copy Markdown
Contributor Author

Can you add a test for this case please? I think we have a bunch for this env var config.

done, and made this to make sure it fails in main: #3839

although both seem stuck on github actions, not sure why. i did get runs working before, maybe i'm being throttled, will come back and check later

@jjb

jjb commented Dec 13, 2025

Copy link
Copy Markdown
Contributor Author

(i could not get tests running locally, contributing.md seems to be out of date - if this is not expected let me know and i'll write it up)

@jjb jjb mentioned this pull request Dec 21, 2025
@jjb

jjb commented Dec 21, 2025

Copy link
Copy Markdown
Contributor Author

i just realized something obvious, any setting could have this problem, so .strip should be invoked on all settings. that's probably fine but should we

  1. add/modify tests for all cases
  2. add/modify tests for no cases, just add .strip
  3. make a helper/wrapper which loads things from env and strips them?

@jjb
jjb marked this pull request as ready for review December 21, 2025 03:51

@dentarg dentarg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to handle anything that's not a number more gracefully?

$ echo 'app { [200, {}, ["OK"]] }' | WEB_CONCURRENCY=foo puma --config /dev/stdin
<internal:kernel>:288:in 'Kernel#Integer': invalid value for Integer(): "foo" (ArgumentError)
	from /Users/dentarg/.arm64_rubies/3.4.8/lib/ruby/gems/3.4.0/gems/puma-7.1.0/lib/puma/configuration.rb:252:in 'Puma::Configuration#puma_options_from_env'
	from /Users/dentarg/.arm64_rubies/3.4.8/lib/ruby/gems/3.4.0/gems/puma-7.1.0/lib/puma/configuration.rb:233:in 'Puma::Configuration#puma_default_options'
	from /Users/dentarg/.arm64_rubies/3.4.8/lib/ruby/gems/3.4.0/gems/puma-7.1.0/lib/puma/configuration.rb:180:in 'Puma::Configuration#initialize'
	from /Users/dentarg/.arm64_rubies/3.4.8/lib/ruby/gems/3.4.0/gems/puma-7.1.0/lib/puma/cli.rb:94:in 'Class#new'
	from /Users/dentarg/.arm64_rubies/3.4.8/lib/ruby/gems/3.4.0/gems/puma-7.1.0/lib/puma/cli.rb:94:in 'Puma::CLI#setup_options'
	from /Users/dentarg/.arm64_rubies/3.4.8/lib/ruby/gems/3.4.0/gems/puma-7.1.0/lib/puma/cli.rb:43:in 'Puma::CLI#initialize'
	from /Users/dentarg/.arm64_rubies/3.4.8/lib/ruby/gems/3.4.0/gems/puma-7.1.0/bin/puma:8:in 'Class#new'
	from /Users/dentarg/.arm64_rubies/3.4.8/lib/ruby/gems/3.4.0/gems/puma-7.1.0/bin/puma:8:in '<top (required)>'
	from /Users/dentarg/.arm64_rubies/3.4.8/bin/puma:25:in 'Kernel#load'
	from /Users/dentarg/.arm64_rubies/3.4.8/bin/puma:25:in '<main>'

Comment thread test/test_config.rb
@dentarg

dentarg commented Jan 9, 2026

Copy link
Copy Markdown
Member

(i could not get tests running locally, contributing.md seems to be out of date - if this is not expected let me know and i'll write it up)

Feel free to make a issue or discussion about this

@dentarg

dentarg commented Jan 9, 2026

Copy link
Copy Markdown
Member

i just realized something obvious, any setting could have this problem, so .strip should be invoked on all settings

Sure, but that could be another PR, I think this addition is worthwhile

@dentarg
dentarg merged commit c40ab69 into puma:main Jan 9, 2026
71 checks passed
@dentarg dentarg added bug and removed waiting-for-review Waiting on review from anyone labels Jan 9, 2026
@jjb
jjb deleted the patch-2 branch January 20, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants