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

Prevent fork bombs in ActiveSupport::ForkTracker #51673

Closed
Karazum opened this issue Apr 26, 2024 · 1 comment
Closed

Prevent fork bombs in ActiveSupport::ForkTracker #51673

Karazum opened this issue Apr 26, 2024 · 1 comment

Comments

@Karazum
Copy link

Karazum commented Apr 26, 2024

Steps to reproduce

require "active_support/fork_tracker"

def init_for_process
  puts "initializing something for current process"
  ActiveSupport::ForkTracker.after_fork { init_for_process }
end

init_for_process

# ...

Process.fork do 
  puts "os is bombed with endless callbacks"
end

Expected behavior

When running after fork callback, prevent it from being executed in current after_fork_callbacks loop

Actual behavior

after_fork callbacks adds another callback resulting in a endless loop

System configuration

Ruby version: 2.7.6

@byroot
Copy link
Member

byroot commented Apr 30, 2024

ActiveSupport::ForkTracker is private API and shouldn't be used by third party code. As such it has no reason to be defensive.

@byroot byroot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants