FIX: properly reset all contexts after forking

Fixes hang on backup
This commit is contained in:
Sam
2016-11-02 13:34:20 +11:00
parent dec4a3386f
commit 7e43e73df6
4 changed files with 39 additions and 0 deletions

28
script/check_forking.rb Normal file
View File

@ -0,0 +1,28 @@
require File.expand_path("../../config/environment", __FILE__)
def pretty
puts "<before>"
puts PrettyText.cook("My pid is #{Process.pid}")
end
Discourse.after_fork
pretty
child = fork do
Discourse.after_fork
pretty
grand_child = fork do
Discourse.after_fork
pretty
puts "try to exit"
Process.kill "KILL", Process.pid
end
puts "before wait 2"
Process.wait grand_child
puts "after wait 2"
Process.kill "KILL", Process.pid
end
puts "before wait 1"
Process.wait child
puts "after wait 1"