Commit 82092366 authored by Stan Hu's avatar Stan Hu

Make rbtrace work under unicorn

The Unicorn master resets any signal handlers and prevents rbtrace
from working properly as a result. Move the `require 'rbtrace'` call
to the Unicorn `after_fork` block and keep the initializer only for Sidekiq.
parent 036c6db8
# frozen_string_literal: true
require 'rbtrace' if ENV['ENABLE_RBTRACE']
# rbtrace needs to be included after the unicorn worker forks.
# See the after_fork block in config/unicorn.rb.example.
require 'rbtrace' if ENV['ENABLE_RBTRACE'] && Sidekiq.server?
......@@ -124,6 +124,10 @@ before_fork do |server, worker|
after_fork do |server, worker|
# Unicorn clears out signals before it forks, so rbtrace won't work
# unless it is enabled after the fork.
require 'rbtrace' if ENV['ENABLE_RBTRACE']
# per-process listener ports for debugging/admin/migrations
# addr = "{9293 +}"
# server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true)
......@@ -77,7 +77,12 @@ and more. However, this is not enabled by default. To enable it, define the
gitlab_rails['env'] = {"ENABLE_RBTRACE" => "1"}
Then reconfigure the system and restart Unicorn and Sidekiq.
Then reconfigure the system and restart Unicorn and Sidekiq. To run this
in Omnibus, run as root:
/opt/gitlab/embedded/bin/ruby /opt/gitlab/embedded/bin/rbtrace
## Common Problems
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment