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

Mark the reporter thread as "fork safe" to avoid warnings #215

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

carlosantoniodasilva
Copy link
Member

This prevents the Reporter thread from generating warnings with puma, which has been warning on any threads created before forking.

The Reporter thread is aware of forking by keeping the current pid around, and initializing another thread if the pid changes. It means we still have a running Reporter on the main puma process in this case, plus one for each forked process (if running in cluster mode, in case of puma.)

References:
rails/rails#40399
puma/puma#2475
https://github.com/puma/puma/releases/tag/v5.1.0

Closes #170

This prevents the Reporter thread from generating warnings with puma,
which has been warning on any threads created before forking.

The Reporter thread is aware of forking by keeping the current `pid`
around, and initializing another thread if the `pid` changes. It means
we still have a running Reporter on the main puma process in this case,
plus one for each forked process (if running in cluster mode, in case of
puma.)

References:
rails/rails#40399
puma/puma#2475
https://github.com/puma/puma/releases/tag/v5.1.0

Closes #170
@carlosantoniodasilva
Copy link
Member Author

carlosantoniodasilva commented Sep 9, 2024

Unrelated judoscale-solid_queue failure (which seems a solid_queue problem)

/home/runner/work/judoscale-ruby/judoscale-ruby/vendor/bundle/ruby/2.7.0/gems/solid_queue-0.8.2/lib/solid_queue/processes/callbacks.rb:8:in `block in <module:Callbacks>': 
uninitialized constant SolidQueue::Processes::Callbacks::ActiveModel (NameError)
Did you mean?  ActiveJob

@adamlogic
Copy link
Collaborator

Unrelated judoscale-solid_queue failure

Very strange, especially since it's been passing fine, and we haven't changed anything. 🤔

CleanShot 2024-09-10 at 07 54 37@2x

Copy link
Collaborator

@adamlogic adamlogic left a comment

Choose a reason for hiding this comment

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

@carlosantoniodasilva
Copy link
Member Author

it's been passing fine, and we haven't changed anything.

I think it's because it picked up a newer version of solid_queue and that's not requiring active model correctly.

@carlosantoniodasilva carlosantoniodasilva merged commit bf92a59 into main Sep 10, 2024
119 of 124 checks passed
@carlosantoniodasilva carlosantoniodasilva deleted the ca-puma-thread-warn branch September 10, 2024 12:41
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 this pull request may close these issues.

Puma 6.2.1 warns about threads started in app boot
2 participants