Skip to content

Conversation

schneems
Copy link
Contributor

@schneems schneems commented Aug 19, 2025

Discussion around this decision is in #3588

close #3588

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.

Updates the available performance cops, these needed fixing:

```
lib/puma/control_cli.rb:251:35: C: [Correctable] Performance/DeletePrefix: Use delete_prefix instead of sub.
          if Signal.list.key? sig.sub(/\ASIG/, '')
                                  ^^^
test/helper.rb:151:23: C: [Correctable] Performance/DeletePrefix: Use delete_prefix instead of sub.
    signal = sig.to_s.sub(/\ASIG/, '').to_sym
                      ^^^
test/runner:61:23: C: [Correctable] Performance/DeleteSuffix: Use delete_suffix instead of sub.
  file_arg = ARGV.pop.sub(/\.rb\z/, '')
                      ^^^
test/runner:63:68: C: [Correctable] Performance/DeleteSuffix: Use delete_suffix instead of sub.
    file_args = file_arg.split(File::PATH_SEPARATOR).map { |fn| fn.sub(/\.rb\z/, '') }
```
@schneems schneems force-pushed the schneems/rev-min-ruby branch from 862a6b3 to 6603abb Compare August 19, 2025 18:19
@schneems schneems added the v7 Breaking changes for v7 label Aug 19, 2025
@MSP-Greg
Copy link
Member

@schneems

  1. Do we need a job testing with rack v1 { os: ubuntu-22.04 , ruby: 3.0 , rack-v: ' rack1' }?

  2. Sorry, I had a comment that stated '# below is only needed for Ruby 2.4', I only meant the following line.

But, now that we're at v3.0, should we try to leave each installed version of RubyGems and Bundler as is? In some cases they're updated. To fix, both MRI & nonMRI would need rubygems: and bundler: either removed or set to default.

@schneems
Copy link
Contributor Author

Do we need a job testing with rack v1 { os: ubuntu-22.04 , ruby: 3.0 , rack-v: ' rack1' }?

I added a proposed policy doc today #3700. If we follow the policy for Rack support listed there, then rack1 support can be removed. I'll add another commit to remove that test, I wasn't sure if it would be runnable with Ruby 3.0 or not and wanted CI to tell me.

Sorry, I had a comment that stated '# below is only needed for Ruby 2.4', I only meant the following line.

I figured that one out after a cascade of CI failures 😅. In blame, the other lines were added after you added that comment (IIRC).

But, now that we're at v3.0, should we try to leave each installed version of RubyGems and Bundler as is? In some cases they're updated. To fix, both MRI & nonMRI would need rubygems: and bundler: either removed or set to default.

I added them back in as they were originally. I'm not totally following what your asking or suggesting here. For github actions yaml I tend to make fairly mechanical changes, if you can make inline code suggestions or describe a higher level change, I'll be happy to look into it.

@schneems
Copy link
Contributor Author

I see your commit on this branch, thanks. Stepping out for a bit if you need to iterate.

@MSP-Greg
Copy link
Member

Yes, added the commit. I'm too familiar with setup-ruby and setup-ruby-pkgs, so I added the links in the yml file.

Re the failures, I've got PR #3694 (only test fixes) and also PR #3582 (sizable refactor), both of which seem to pass CI. Not sure why #3582 is passing the few odd jobs that fail, I need to compare the two.

PR #3582 doesn't change any public API's, but it may mess up a lot of open PR's when it's merged. Simply put, it encapsulates all request code in Client. Or, when Client is finished, it's the request is ready to be passed to the app.

@schneems schneems marked this pull request as ready for review August 19, 2025 20:57
@github-actions github-actions bot added the waiting-for-review Waiting on review from anyone label Aug 19, 2025
@schneems
Copy link
Contributor Author

This is all green now. Thanks for your help! I approved #3694, can you merge these two and resolve conflicts? (merge order is up to you).

I peeked at #3582 it seems large I've not dug in. If it's not a change we could merge post v7, there are some config related PRs that are ready to merge, but need rebase and re-test https://github.com/puma/puma/issues?q=state%3Aopen%20label%3Av7. If those are merged and tests are passsing on this #3582 I'm okay merging it in (pending a review).

@MSP-Greg
Copy link
Member

This is all green now

I did run the failed tests again, but it shows the intermittent issues with CI (fail, then pass).

can you merge these two and resolve conflicts?

Not sure what you mean by two? This and #3694?

I'd like to look at why tests are passing with #3582, because I did not make the changes that were contained in #3694.

@MSP-Greg MSP-Greg mentioned this pull request Aug 19, 2025
7 tasks
@schneems
Copy link
Contributor Author

This and #3694?

Yes.

I'd like to look at why tests are passing with #3582, because I did not make the changes that were contained in #3694.

It's my general assumption that the suite is flappy right now and that some re-starts fix intermittent issues. As long as they're all green once, that's good enough for me, for now.

@joshuay03
Copy link
Contributor

This is looking great!!

Some other things I found that can probably be updated or removed:

  • puma/README.md

    Lines 435 to 446 in ee9b2c4

    ## Known Bugs
    For MRI versions 2.2.7, 2.2.8, 2.2.9, 2.2.10, 2.3.4 and 2.4.1, you may see ```stream closed in another thread (IOError)```. It may be caused by a [Ruby bug](https://bugs.ruby-lang.org/issues/13632). It can be fixed with the gem https://rubygems.org/gems/stopgap_13632:
    ```ruby
    if %w(2.2.7 2.2.8 2.2.9 2.2.10 2.3.4 2.4.1).include? RUBY_VERSION
    begin
    require 'stopgap_13632'
    rescue LoadError
    end
    end
    ```
    (Might want to keep this around for people using older versions? But imo the readme should reflect master)
  • # Random.bytes available in Ruby 2.5 and later, Random::DEFAULT deprecated in 3.0
    if Random.respond_to?(:bytes)
    $defs.push "-DHAVE_RANDOM_BYTES"
    puts "checking for Random.bytes... yes"
    else
    puts "checking for Random.bytes... no"
    end
    end
  • if respond_to?(:append_cflags, true) # Ruby 2.5 and later
    append_cflags(config_string('WERRORFLAG') || '-Werror')
    append_cflags '-Wno-implicit-fallthrough'
    else
    # flag may not exist on some platforms, -Werror may not be defined on some platforms, but
    # works with all in current CI
    $CFLAGS << " #{config_string('WERRORFLAG') || '-Werror'}"
    $CFLAGS << ' -Wno-implicit-fallthrough'
    end
  • # @todo remove each once Ruby 2.5 is no longer supported
    status.tr('}{"', '').strip.split(", ").each do |kv|
    cntr = 0
    kv.split(':').each do |t|
    if cntr == 0
    k = t
    cntr = 1
    else
    v = t
    end
    end
    hsh[k.to_sym] = v.to_i
    end
  • puma/lib/puma/cluster.rb

    Lines 376 to 380 in ee9b2c4

    # Process::Waiter check here because there's a bug in Ruby 2.6 and below
    # where calling thread_variable_get on a Process::Waiter will segfault.
    # We can drop that clause once those versions of Ruby are no longer
    # supported.
    fork_safe = ->(t) { !t.is_a?(Process::Waiter) && t.thread_variable_get(:fork_safe) }
  • # before Ruby 2.5, `write` would only take one argument
    if RUBY_ENGINE != 'truffleruby'
    alias_method :append, :write
    else
    def append(*strs)
    strs.each { |str| write str }
    end
    end
  • # Ruby 2.0+ defaults to true which breaks socket activation
    args += [{:close_others => false}]
  • class IO
    # We need to use this for a jruby work around on both 1.8 and 1.9.
    # So this either creates the constant (on 1.8), or harmlessly
    # reopens it (on 1.9).
    module WaitReadable
    end
    end

@schneems schneems force-pushed the schneems/rev-min-ruby branch from 6194a83 to e32e96f Compare August 20, 2025 16:59
https://hub.docker.com/layers/library/ruby/3.4.5-alpine/images/sha256-5dd7ab3c51da265f3b3a4eed3dfd90ffd116c32dc99d1a584c7141cca92a6c93

Trim trailing whitespace and make sure there's vertical whitespace after a paragraph, before a code section
```
⛄️ 3.4.5 🚀 /Users/rschneeman/Documents/projects/puma (schneems/rev-min-ruby)
$ irb
irb(main):001> Thread.attr_accessor :puma_server
=> [:puma_server, :puma_server=]
```
Patch #1345 was added as a workaround for https://bugs.ruby-lang.org/issues/13632. 

The gem addition was already removed in another commit. An un-monkey-patched version of Ruby does not have this method, so the respond_to? check always returns false, so this code is currently a no-op anyway.

```
(irb):2:in '<main>': undefined method 'purge_interrupt_queue' for an instance of Thread (NoMethodError)
	from <internal:kernel>:168:in 'Kernel#loop'
	from /Users/rschneeman/.gem/ruby/3.4.5/gems/irb-1.15.2/exe/irb:9:in '<top (required)>'
	from /Users/rschneeman/.gem/ruby/3.4.5/bin/irb:25:in 'Kernel#load'
	from /Users/rschneeman/.gem/ruby/3.4.5/bin/irb:25:in '<main>'
```
This version was previously removed from CI, this is the only `rack1` reference in the codebase.
@schneems
Copy link
Contributor Author

@joshuay03 thanks for the assist 💯 I searched for 2. and found some more references. Waiting on CI now.

Copy link
Member

@dentarg dentarg left a comment

Choose a reason for hiding this comment

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

🥳

@github-actions github-actions bot added waiting-for-merge and removed waiting-for-review Waiting on review from anyone labels Aug 20, 2025
@schneems schneems merged commit df8b275 into master Aug 21, 2025
203 of 204 checks passed
@schneems schneems deleted the schneems/rev-min-ruby branch August 21, 2025 13:36
@dentarg dentarg added this to the 7.0.0 milestone Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v7 Breaking changes for v7
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop Ruby < 3.0 ?
4 participants