You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It's no longer required for Active Record, and other common libraries (dalli, redis-rb) all seem to be fork-proof too.
I was going to drop the more obscure before_fork but keep on_worker_boot... but I couldn't come up with a way to describe when it's necessary or what to do, nor a plausible example. (Not because it's hard to describe the problem it fixes, but because the "except for all common libraries" exception makes it sound silly and confusing.)
Maybe we can just drop it entirely. If most people don't need it, it seems fine to treat it like any other Puma config option that exists but isn't promoted in the generated file.
Alternatively, does anyone have any other good examples of widely-seen code that apps need in one or both of these? CodeTriage says no; Discourse does a lot, but nothing that strikes me as needing general promotion.
Does this mean that if we have existing before_fork and on_worker_boot blocks in our pre-Rails 5.2.0 puma.rb file, we can now simply remove those blocks after upgrading to Rails 5.2.0?
The Puma repo still recommends the use of these blocks in its documentation:
If you're preloading your application and using ActiveRecord, it's recommended that you setup your connection pool [in on_worker_boot]
So there's just a little bit of conflicting information here. But I recognize that Rails 5.2.0 just came out so hopefully documentation will converge and this query will add a bit to that effort.
Does this mean that if we have existing before_fork and on_worker_boot blocks in our pre-Rails 5.2.0 puma.rb file, we can now simply remove those blocks after upgrading to Rails 5.2.0?
Yes. (Assuming they're doing AR connection management, of course.)
They're perfectly safe to leave there, so it's not called out in the upgrade guide, but they should no longer be necessary.
ledermann
added a commit
to ledermann/docker-rails
that referenced
this pull request
Apr 26, 2018
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's no longer required for Active Record, and other common libraries (dalli, redis-rb) all seem to be fork-proof too.
I was going to drop the more obscure
before_fork
but keepon_worker_boot
... but I couldn't come up with a way to describe when it's necessary or what to do, nor a plausible example. (Not because it's hard to describe the problem it fixes, but because the "except for all common libraries" exception makes it sound silly and confusing.)Maybe we can just drop it entirely. If most people don't need it, it seems fine to treat it like any other Puma config option that exists but isn't promoted in the generated file.
Alternatively, does anyone have any other good examples of widely-seen code that apps need in one or both of these? CodeTriage says no; Discourse does a lot, but nothing that strikes me as needing general promotion.
cc @schneems @nateberkopec
(this is follow-on from #31221 and #31173, which remove the need for AR connection management)