Infinite Stack Recursion when using Sentry


I wanted to post on here to see if anyone had ideas about this bug I am seeing when trying to use Sentry with discourse. I am looking to use Sentry (using the open source Glitchtip server implementation) to collect all errors raised in background tasks and in the server. I know that discourse has its own error collection with Logster, but I wanted to try using Sentry to help track all the errors that are raised and inspect them with more context.

I added an initializer with the Sentry config:

Sentry.init do |config|
  config.breadcrumbs_logger = [:active_support_logger, :http_logger]

  config.dsn =  ENV['SENTRY_DSN']

and was finding that it was infinitely recursing during HTTP calls of the rake tasks and sidekiq tasks (even if they would exit cleanly before sentry was added). There are more details and a way to reproduce on the Github issue I opened with sentry-ruby:

I know that I am not using the supported discourse_docker repo, but I wanted to post here anyway to see if anyone else may have come across a similar error and had any ideas.

Note that there is an existing discourse sentry plugin (Discourse Sentry), but it uses an unsupported client library (sentry-raven) so I choose not to use it.

For anyone interested in using Sentry with Discourse, one of the maintainers of the package replied with a suggested fix.

They said that the problem was coming from Discourse’s MethodProfiler which uses alias_method. They suggested replacing that with prepend which they said was becoming more common and would allow both tools to work together.

I am not familiar enough with Ruby to understand the differences. For now, I will try commenting out this bit of code to disable Discourse’s method profiling.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.