আমি ইউনিকর্ন এবং সাইডিকিক চলমান একটি হেরোকু অ্যাপ্লিকেশানের জন্য আর 12 প্রস্থান সময়সীমা ত্রুটিগুলি পেয়েছি। এই ত্রুটিগুলি দিনে 1-2 বার ঘটে এবং যখনই আমি নিযুক্ত করি। আমি বুঝতে পেরেছি যে ইউনিকর্ন সঠিকভাবে প্রতিক্রিয়া জানাতে আমাকে হিরোকু থেকে শাটডাউন সংকেত রূপান্তর করতে হবে, তবে আমি ভেবেছিলাম যে আমি এটি নীচের ইউনিকর্ন কনফিগারেশনে করেছি:
worker_processes 3
timeout 30
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
puts "Unicorn master intercepting TERM and sending myself QUIT instead. My PID is #{Process.pid}"
Process.kill 'QUIT', Process.pid
end
if defined?(ActiveRecord::Base)
ActiveRecord::Base.connection.disconnect!
Rails.logger.info('Disconnected from ActiveRecord')
end
end
after_fork do |server, worker|
Signal.trap 'TERM' do
puts "Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT. My PID is #{Process.pid}"
end
if defined?(ActiveRecord::Base)
ActiveRecord::Base.establish_connection
Rails.logger.info('Connected to ActiveRecord')
end
Sidekiq.configure_client do |config|
config.redis = { :size => 1 }
end
end
ত্রুটিটিকে ঘিরে আমার লগগুলি এ জাতীয় দেখাচ্ছে:
Stopping all processes with SIGTERM
Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT. My PID is 7
Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT. My PID is 11
Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT. My PID is 15
Unicorn master intercepting TERM and sending myself QUIT instead. My PID is 2
Started GET "/manage"
reaped #<Process::Status: pid 11 exit 0> worker=1
reaped #<Process::Status: pid 7 exit 0> worker=0
reaped #<Process::Status: pid 15 exit 0> worker=2
master complete
Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
Stopping remaining processes with SIGKILL
Process exited with status 137
এটি প্রদর্শিত হয় যে শিশু প্রক্রিয়াগুলির সমস্ত সফলভাবে সময় শেষ হওয়ার আগেই কাটা হয়েছিল। এটা কি সম্ভব গুরু এখনও বেঁচে আছেন? এছাড়াও, রাউটারটি এখনও লগগুলিতে প্রদর্শিত হিসাবে, শাট ডাউন করার সময় ডায়নোতে ওয়েব অনুরোধগুলি প্রেরণ করা উচিত?
এফডাব্লুআইডাব্লু, আমি হিরোকুর শূন্য ডাউনটাইম ডিপ্লোয়মেন্ট প্লাগইন ( https://devcenter.heroku.com/articles/labs-preboot/ ) ব্যবহার করছি ।