summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-07-24 22:15:52 -0700
committerStan Hu <stanhu@gmail.com>2018-07-25 04:41:40 -0700
commitb755673fb63b57751657a55f568ca809e5c7901e (patch)
tree26aba0d729449126b86b5e36fa7efd180aa83555
parent6cb30f83255f0982646fea688f2fe275a3b22cc7 (diff)
downloadgitlab-ce-sh-include-rbtrace.tar.gz
Add rbtrace to Gemfilesh-include-rbtrace
This will be enabled if ENABLE_RBTRACE environment variable is defined. This will allow us to debug all sorts of issues in production: https://github.com/tmm1/rbtrace
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock6
-rw-r--r--Gemfile.rails5.lock6
-rw-r--r--changelogs/unreleased/sh-include-rbtrace.yml5
-rw-r--r--config/initializers/rbtrace.rb3
-rw-r--r--doc/administration/troubleshooting/debug.md13
6 files changed, 34 insertions, 0 deletions
diff --git a/Gemfile b/Gemfile
index 47815f230d3..a7bf5c500ca 100644
--- a/Gemfile
+++ b/Gemfile
@@ -400,6 +400,7 @@ gem 'email_reply_trimmer', '~> 0.1'
gem 'html2text'
gem 'ruby-prof', '~> 0.17.0'
+gem 'rbtrace', '~> 0.4', require: false
# OAuth
gem 'oauth2', '~> 1.4'
diff --git a/Gemfile.lock b/Gemfile.lock
index 22626c0071b..2a8b2579605 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -700,6 +700,10 @@ GEM
ffi (>= 0.5.0, < 2)
rblineprof (0.3.6)
debugger-ruby_core_source (~> 1.3)
+ rbtrace (0.4.10)
+ ffi (>= 1.0.6)
+ msgpack (>= 0.4.3)
+ trollop (>= 1.16.2)
rdoc (6.0.4)
re2 (1.1.1)
recaptcha (3.0.0)
@@ -911,6 +915,7 @@ GEM
parslet (~> 1.5.0)
toml-rb (1.0.0)
citrus (~> 3.0, > 3.0)
+ trollop (2.1.3)
truncato (0.7.10)
htmlentities (~> 4.3.1)
nokogiri (~> 1.8.0, >= 1.7.0)
@@ -1133,6 +1138,7 @@ DEPENDENCIES
rainbow (~> 2.2)
raindrops (~> 0.18)
rblineprof (~> 0.3.6)
+ rbtrace (~> 0.4)
rdoc (~> 6.0)
re2 (~> 1.1.1)
recaptcha (~> 3.0)
diff --git a/Gemfile.rails5.lock b/Gemfile.rails5.lock
index 5a0aaf05608..36d758f0558 100644
--- a/Gemfile.rails5.lock
+++ b/Gemfile.rails5.lock
@@ -709,6 +709,10 @@ GEM
ffi (>= 0.5.0, < 2)
rblineprof (0.3.6)
debugger-ruby_core_source (~> 1.3)
+ rbtrace (0.4.10)
+ ffi (>= 1.0.6)
+ msgpack (>= 0.4.3)
+ trollop (>= 1.16.2)
rdoc (6.0.4)
re2 (1.1.1)
recaptcha (3.0.0)
@@ -918,6 +922,7 @@ GEM
parslet (~> 1.5.0)
toml-rb (1.0.0)
citrus (~> 3.0, > 3.0)
+ trollop (2.1.3)
truncato (0.7.10)
htmlentities (~> 4.3.1)
nokogiri (~> 1.8.0, >= 1.7.0)
@@ -1144,6 +1149,7 @@ DEPENDENCIES
rainbow (~> 2.2)
raindrops (~> 0.18)
rblineprof (~> 0.3.6)
+ rbtrace (~> 0.4)
rdoc (~> 6.0)
re2 (~> 1.1.1)
recaptcha (~> 3.0)
diff --git a/changelogs/unreleased/sh-include-rbtrace.yml b/changelogs/unreleased/sh-include-rbtrace.yml
new file mode 100644
index 00000000000..41f0655e3f8
--- /dev/null
+++ b/changelogs/unreleased/sh-include-rbtrace.yml
@@ -0,0 +1,5 @@
+---
+title: Add rbtrace to Gemfile
+merge_request: 20831
+author:
+type: other
diff --git a/config/initializers/rbtrace.rb b/config/initializers/rbtrace.rb
new file mode 100644
index 00000000000..3a076c99ad0
--- /dev/null
+++ b/config/initializers/rbtrace.rb
@@ -0,0 +1,3 @@
+# frozen_string_literal: true
+
+require 'rbtrace' if ENV['ENABLE_RBTRACE']
diff --git a/doc/administration/troubleshooting/debug.md b/doc/administration/troubleshooting/debug.md
index 83a714810c1..7ae4f7c1515 100644
--- a/doc/administration/troubleshooting/debug.md
+++ b/doc/administration/troubleshooting/debug.md
@@ -66,6 +66,19 @@ On CentOS:
sudo yum install gdb
```
+### rbtrace
+
+GitLab 11.2 ships with [rbtrace](https://github.com/tmm1/rbtrace), which
+allows you to trace Ruby code, view all running threads, take memory dumps,
+and more. However, this is not enabled by default. To enable it, define the
+`ENABLE_RBTRACE` variable to the environment. For example, in Omnibus:
+
+```ruby
+gitlab_rails['env'] = {"ENABLE_RBTRACE" => "1"}
+```
+
+Then reconfigure the system and restart Unicorn and Sidekiq.
+
## Common Problems
Many of the tips to diagnose issues below apply to many different situations. We'll use one