Skip to content

Remove backtrace silencer for app dir

Stan Hu requested to merge sh-remove-app-backtrace-cleaner into master

What does this MR do and why?

Exceptions may occur in gems used by GitLab. This change makes it possible to see exactly where the error occurred. The previous backtrace silencer was primarily used for the profiler, so we make it possible to use it there.

How to set up and validate locally

To simulate a real failure in a gem, I patched the redis gem:

  1. Find the location:
% bundle exec gem which redis
/Users/stanhu/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/redis-4.8.0/lib/redis.rb
  1. I patched ~/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/redis-4.8.0/lib/redis/client.rb
diff --git a/lib/redis/client.rb b/lib/redis/client.rb
index 3e620fa..19052c8 100644
--- a/lib/redis/client.rb
+++ b/lib/redis/client.rb
@@ -96,6 +96,7 @@ class Redis
       @command_map = {}

       @pending_reads = 0
+      @value = 0

       @connector =
         if !@options[:sentinels].nil?
@@ -158,6 +159,13 @@ class Redis
     end

     def call(command)
+      @value = 0
+      @value += 1
+
+      if @value > 30
+        some_bogus_call
+      end
+
       reply = process([command]) { read }
       raise reply if reply.is_a?(CommandError)
  1. Then I ran gdk restart rails-web and watched gitlab/log/development.log for the stack trace.
Edited by Stan Hu

Merge request reports