Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exceptions no longer reported after 5.3.1 -> 5.4.1 upgrade #1859

Closed
ckdake opened this issue Jul 29, 2022 · 9 comments
Closed

Exceptions no longer reported after 5.3.1 -> 5.4.1 upgrade #1859

ckdake opened this issue Jul 29, 2022 · 9 comments
Assignees

Comments

@ckdake
Copy link

ckdake commented Jul 29, 2022

Issue Description

Hello! We updated a production rails app from sentry-ruby 5.3.1 to 5.4.1 and noticed that some exceptions stopped being reported to sentry.

Our sentry.rb initializer:

if Rails.env == "production" || Rails.env == "demo"
  Sentry.init do |config|
    config.dsn = Rails.application.credentials.sentry_dsn
    config.breadcrumbs_logger = [:active_support_logger, :http_logger]
    config.environment = Rails.env
  end

  tenant = ENV.fetch("TENANT", "unknown")
  Sentry.set_tags(tenant: tenant)
  Sentry.set_context("tenant", {tenant: tenant})
end

We are also instrumented with opentelemetry (opentelemetry-api (1.0.2), opentelemetry-instrumentation-active_record (0.4.0), opentelemetry-instrumentation-rack (0.21.0))

Our opentelemetry.rb initializer:

require "opentelemetry/sdk"
require "opentelemetry/exporter/otlp"

if Rails.env == "production" || Rails.env == "demo"
  OpenTelemetry::SDK.configure do |c|
    c.use "OpenTelemetry::Instrumentation::ActiveSupport"
    c.use "OpenTelemetry::Instrumentation::ActionPack"
    c.use "OpenTelemetry::Instrumentation::ActiveJob"
    c.use "OpenTelemetry::Instrumentation::ActiveRecord"
    c.use "OpenTelemetry::Instrumentation::ActionView"
    c.use "OpenTelemetry::Instrumentation::ConcurrentRuby"
    c.use "OpenTelemetry::Instrumentation::Faraday"
    c.use "OpenTelemetry::Instrumentation::Net::HTTP"
    c.use "OpenTelemetry::Instrumentation::PG"
    c.use "OpenTelemetry::Instrumentation::Rack"
    c.use "OpenTelemetry::Instrumentation::Rails"
  end
end

I suspect that this may be somehow related to the changes for:

#1847

Things that worked both with 5.3.1 and 5.4.1

Both of these resulted in errors in the logs, as well as errors getting pushed to sentry.

Sentry.capture_message("test message")

and an error from rake db:setup:

PG::InsufficientPrivilege: ERROR:  permission denied to create database

Things that only worked with 5.3.1 and do not work with 5.4.1

from within the rails app, this error would appear in the logs but not get pushed to sentry.

PG::UndefinedColumn: ERROR:  column redacted.redacted_id does not exist
LINE 1: SELECT "redacted".* FROM "redacted" WHERE "redacted"."redacted_...

Reproduction Steps

You can reproduce this issue in a new scaffolded rails app with opentelemetry and sentry with the two above initializers.

Expected Behavior

PG::UndefinedColumn: ERROR surfaces in the Sentry UI

Actual Behavior

PG::UndefinedColumn: ERROR does not surface in the Sentry UI

Ruby Version

3.1.2

SDK Version

3.4.1

Integration and Its Version

Rails 7.0.3

Sentry Config

if Rails.env == "production" || Rails.env == "demo"
  Sentry.init do |config|
    config.dsn = Rails.application.credentials.sentry_dsn
    config.breadcrumbs_logger = [:active_support_logger, :http_logger]
    config.environment = Rails.env
  end

  tenant = ENV.fetch("TENANT", "unknown")
  Sentry.set_tags(tenant: tenant)
  Sentry.set_context("tenant", {tenant: tenant})
end
@st0012
Copy link
Collaborator

st0012 commented Jul 30, 2022

I tried to produce the error with these initializers

OpenTelemetry::SDK.configure do |c|
  c.use "OpenTelemetry::Instrumentation::ActiveSupport"
  c.use "OpenTelemetry::Instrumentation::ActionPack"
  c.use "OpenTelemetry::Instrumentation::ActiveJob"
  c.use "OpenTelemetry::Instrumentation::ActiveRecord"
  c.use "OpenTelemetry::Instrumentation::ActionView"
  c.use "OpenTelemetry::Instrumentation::ConcurrentRuby"
  c.use "OpenTelemetry::Instrumentation::Faraday"
  c.use "OpenTelemetry::Instrumentation::Net::HTTP"
  c.use "OpenTelemetry::Instrumentation::PG"
  c.use "OpenTelemetry::Instrumentation::Rack"
  c.use "OpenTelemetry::Instrumentation::Rails"
end

Sentry.init do |config|
  config.dsn = 'https://2fb45f003d054a7ea47feb45898f7649@o447951.ingest.sentry.io/5434472'
  config.breadcrumbs_logger = [:active_support_logger, :http_logger]
  config.environment = Rails.env
end

tenant = ENV.fetch("TENANT", "unknown")
Sentry.set_tags(tenant: tenant)
Sentry.set_context("tenant", {tenant: tenant})

And these dependencies

  * opentelemetry-api (1.0.2)
  * opentelemetry-common (0.19.6)
  * opentelemetry-exporter-otlp (0.23.0)
  * opentelemetry-instrumentation-action_pack (0.2.0)
  * opentelemetry-instrumentation-action_view (0.3.0)
  * opentelemetry-instrumentation-active_job (0.3.0)
  * opentelemetry-instrumentation-active_model_serializers (0.19.0)
  * opentelemetry-instrumentation-active_record (0.4.0)
  * opentelemetry-instrumentation-active_support (0.2.0)
  * opentelemetry-instrumentation-all (0.25.0)
  * opentelemetry-instrumentation-aws_sdk (0.3.1)
  * opentelemetry-instrumentation-base (0.21.0)
  * opentelemetry-instrumentation-bunny (0.19.0)
  * opentelemetry-instrumentation-concurrent_ruby (0.20.0)
  * opentelemetry-instrumentation-dalli (0.22.0)
  * opentelemetry-instrumentation-delayed_job (0.19.0)
  * opentelemetry-instrumentation-ethon (0.20.0)
  * opentelemetry-instrumentation-excon (0.20.0)
  * opentelemetry-instrumentation-faraday (0.21.0)
  * opentelemetry-instrumentation-graphql (0.20.0)
  * opentelemetry-instrumentation-http (0.20.0)
  * opentelemetry-instrumentation-http_client (0.20.0)
  * opentelemetry-instrumentation-koala (0.19.0)
  * opentelemetry-instrumentation-lmdb (0.21.0)
  * opentelemetry-instrumentation-mongo (0.20.0)
  * opentelemetry-instrumentation-mysql2 (0.21.0)
  * opentelemetry-instrumentation-net_http (0.20.0)
  * opentelemetry-instrumentation-pg (0.21.0)
  * opentelemetry-instrumentation-que (0.4.0)
  * opentelemetry-instrumentation-rack (0.21.0)
  * opentelemetry-instrumentation-rails (0.22.0)
  * opentelemetry-instrumentation-rdkafka (0.2.0)
  * opentelemetry-instrumentation-redis (0.23.0)
  * opentelemetry-instrumentation-resque (0.3.0)
  * opentelemetry-instrumentation-restclient (0.20.0)
  * opentelemetry-instrumentation-ruby_kafka (0.19.0)
  * opentelemetry-instrumentation-sidekiq (0.22.0)
  * opentelemetry-instrumentation-sinatra (0.20.0)
  * opentelemetry-instrumentation-trilogy (0.51.0)
  * opentelemetry-registry (0.1.0)
  * opentelemetry-sdk (1.1.0)
  * opentelemetry-semantic_conventions (1.8.0)
  * sentry-delayed_job (5.4.1)
  * sentry-rails (5.4.1)
  * sentry-resque (5.4.1)
  * sentry-ruby (5.4.1)
  * sentry-sidekiq (5.4.1)

And I still received events from a similar database error (don't have PG):

截圖 2022-07-30 12 49 01

So it'll be great if you can

  • Provide an example app to reproduce the error
  • Give me the full stacktrace from 5.3.1
  • Set config.debug = true on the SDK and tell me if you see anything different between 5.3.1 and 5.4.1's output

@ckdake
Copy link
Author

ckdake commented Aug 1, 2022

Thanks for investigating! I've set config.debug = true and am investigating this in local development with Sentry now enabled for all environments.

On 5.3.1 the error appears in the console logs, a large json blob of sentry debug output appears in the console logs, and the error appears in sentry. As expected for local dev, the stacktrace shows on the Rails error page.

On 5.4.1, the error appears in the console logs, there is no output from sentry in the console log, and the error does not appear in sentry. Unexpectedly, the stacktrace message is replaced with the "we're sorry but something went wrong" error page that we'd expect in production.

I've removed opentelemetry to make sure it's not a contributing factor here, and the test output is the same as described above.

Full stacktrace of an error that "works" in 5.3.1 and "doesnt work" in 5.4.1:

[activerecord (7.0.3.1) lib/active_record/connection_adapters/postgresql/database_statements.rb:19:in `exec'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/connection_adapters/postgresql/database_statements.rb:19:in `block (2 levels) in query'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/dependencies/interlock.rb:41:in `permit_concurrent_loads'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/connection_adapters/postgresql/database_statements.rb:18:in `block in query'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/connection_adapters/abstract_adapter.rb:765:in `block in log'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/connection_adapters/abstract_adapter.rb:756:in `log'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/connection_adapters/postgresql/database_statements.rb:17:in `query'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/connection_adapters/postgresql_adapter.rb:916:in `column_definitions'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/connection_adapters/abstract/schema_statements.rb:116:in `columns'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/connection_adapters/schema_cache.rb:117:in `block in columns'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/connection_adapters/schema_cache.rb:116:in `fetch'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/connection_adapters/schema_cache.rb:116:in `columns'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/connection_adapters/schema_cache.rb:125:in `block in columns_hash'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/connection_adapters/schema_cache.rb:124:in `fetch'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/connection_adapters/schema_cache.rb:124:in `columns_hash'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/model_schema.rb:568:in `load_schema!'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/attributes.rb:264:in `load_schema!'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/encryption/encryptable_record.rb:122:in `load_schema!'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/model_schema.rb:554:in `block in load_schema'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/model_schema.rb:551:in `synchronize'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/model_schema.rb:551:in `load_schema'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/model_schema.rb:407:in `columns_hash'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/relation/query_methods.rb:1510:in `arel_column'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/relation/query_methods.rb:1639:in `order_column'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/relation/query_methods.rb:1610:in `block (2 levels) in preprocess_order_args'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/relation/query_methods.rb:1605:in `each'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/relation/query_methods.rb:1605:in `map'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/relation/query_methods.rb:1605:in `block in preprocess_order_args'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/relation/query_methods.rb:1600:in `map!'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/relation/query_methods.rb:1600:in `preprocess_order_args'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/relation/query_methods.rb:434:in `order!'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/relation/query_methods.rb:429:in `order'](http://localhost:3000/#)
[app/controllers/customers_controller.rb:10:in `index'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/abstract_controller/base.rb:215:in `process_action'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_controller/metal/rendering.rb:53:in `process_action'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/abstract_controller/callbacks.rb:234:in `block in process_action'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/callbacks.rb:118:in `block in run_callbacks'](http://localhost:3000/#)
[actiontext (7.0.3.1) lib/action_text/rendering.rb:20:in `with_renderer'](http://localhost:3000/#)
[actiontext (7.0.3.1) lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/callbacks.rb:127:in `instance_exec'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/callbacks.rb:127:in `block in run_callbacks'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/callbacks.rb:138:in `run_callbacks'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/abstract_controller/callbacks.rb:233:in `process_action'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_controller/metal/rescue.rb:22:in `process_action'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/notifications.rb:206:in `block in instrument'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/notifications.rb:206:in `instrument'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_controller/metal/instrumentation.rb:66:in `process_action'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/railties/controller_runtime.rb:27:in `process_action'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/abstract_controller/base.rb:151:in `process'](http://localhost:3000/#)
[actionview (7.0.3.1) lib/action_view/rendering.rb:39:in `process'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_controller/metal.rb:188:in `dispatch'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_controller/metal.rb:251:in `dispatch'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/journey/router.rb:50:in `block in serve'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/journey/router.rb:32:in `each'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/journey/router.rb:32:in `serve'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/routing/route_set.rb:852:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/middleware/static.rb:23:in `call'](http://localhost:3000/#)
[omniauth (2.1.0) lib/omniauth/strategy.rb:202:in `call!'](http://localhost:3000/#)
[omniauth (2.1.0) lib/omniauth/strategy.rb:169:in `call'](http://localhost:3000/#)
[omniauth (2.1.0) lib/omniauth/builder.rb:44:in `call'](http://localhost:3000/#)
[rack (2.2.4) lib/rack/tempfile_reaper.rb:15:in `call'](http://localhost:3000/#)
[rack (2.2.4) lib/rack/etag.rb:27:in `call'](http://localhost:3000/#)
[rack (2.2.4) lib/rack/conditional_get.rb:27:in `call'](http://localhost:3000/#)
[rack (2.2.4) lib/rack/head.rb:12:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/http/permissions_policy.rb:38:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/http/content_security_policy.rb:36:in `call'](http://localhost:3000/#)
[rack (2.2.4) lib/rack/session/abstract/id.rb:266:in `context'](http://localhost:3000/#)
[rack (2.2.4) lib/rack/session/abstract/id.rb:260:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/middleware/cookies.rb:697:in `call'](http://localhost:3000/#)
[activerecord (7.0.3.1) lib/active_record/migration.rb:603:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/callbacks.rb:99:in `run_callbacks'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/middleware/executor.rb:14:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'](http://localhost:3000/#)
[sentry-rails (5.3.1) lib/sentry/rails/rescued_exception_interceptor.rb:12:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'](http://localhost:3000/#)
[web-console (4.2.0) lib/web_console/middleware.rb:132:in `call_app'](http://localhost:3000/#)
[web-console (4.2.0) lib/web_console/middleware.rb:28:in `block in call'](http://localhost:3000/#)
[web-console (4.2.0) lib/web_console/middleware.rb:17:in `catch'](http://localhost:3000/#)
[web-console (4.2.0) lib/web_console/middleware.rb:17:in `call'](http://localhost:3000/#)
[sentry-ruby-core (5.3.1) lib/sentry/rack/capture_exceptions.rb:26:in `block (2 levels) in call'](http://localhost:3000/#)
[sentry-ruby-core (5.3.1) lib/sentry/hub.rb:199:in `with_session_tracking'](http://localhost:3000/#)
[sentry-ruby-core (5.3.1) lib/sentry-ruby.rb:351:in `with_session_tracking'](http://localhost:3000/#)
[sentry-ruby-core (5.3.1) lib/sentry/rack/capture_exceptions.rb:17:in `block in call'](http://localhost:3000/#)
[sentry-ruby-core (5.3.1) lib/sentry/hub.rb:59:in `with_scope'](http://localhost:3000/#)
[sentry-ruby-core (5.3.1) lib/sentry-ruby.rb:331:in `with_scope'](http://localhost:3000/#)
[sentry-ruby-core (5.3.1) lib/sentry/rack/capture_exceptions.rb:16:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'](http://localhost:3000/#)
[railties (7.0.3.1) lib/rails/rack/logger.rb:40:in `call_app'](http://localhost:3000/#)
[railties (7.0.3.1) lib/rails/rack/logger.rb:25:in `block in call'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/tagged_logging.rb:114:in `block in tagged'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/tagged_logging.rb:38:in `tagged'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/tagged_logging.rb:114:in `tagged'](http://localhost:3000/#)
[railties (7.0.3.1) lib/rails/rack/logger.rb:25:in `call'](http://localhost:3000/#)
[sprockets-rails (3.4.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/middleware/request_id.rb:26:in `call'](http://localhost:3000/#)
[rack (2.2.4) lib/rack/method_override.rb:24:in `call'](http://localhost:3000/#)
[rack (2.2.4) lib/rack/runtime.rb:22:in `call'](http://localhost:3000/#)
[activesupport (7.0.3.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/middleware/server_timing.rb:20:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/middleware/executor.rb:14:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/middleware/static.rb:23:in `call'](http://localhost:3000/#)
[rack (2.2.4) lib/rack/sendfile.rb:110:in `call'](http://localhost:3000/#)
[actionpack (7.0.3.1) lib/action_dispatch/middleware/host_authorization.rb:137:in `call'](http://localhost:3000/#)
[railties (7.0.3.1) lib/rails/engine.rb:530:in `call'](http://localhost:3000/#)
[puma (5.6.4) lib/puma/configuration.rb:252:in `call'](http://localhost:3000/#)
[puma (5.6.4) lib/puma/request.rb:77:in `block in handle_request'](http://localhost:3000/#)
[puma (5.6.4) lib/puma/thread_pool.rb:340:in `with_force_shutdown'](http://localhost:3000/#)
[puma (5.6.4) lib/puma/request.rb:76:in `handle_request'](http://localhost:3000/#)
[puma (5.6.4) lib/puma/server.rb:441:in `process_client'](http://localhost:3000/#)
[puma (5.6.4) lib/puma/thread_pool.rb:147:in `block in spawn_thread'](http://localhost:3000/#)

I'll see if I can get a sample app up that experiences this.

@ckdake
Copy link
Author

ckdake commented Aug 1, 2022

Easier than expected, here you go! https://github.com/ckdake/test-sentry-upgrade.

@st0012
Copy link
Collaborator

st0012 commented Aug 2, 2022

I found the cause: you should use 5.4.1 for both sentry-ruby and sentry-rails but you're using 5.3.1 for sentry-rails instead. And between the 2 versions there are internal API changes so the error you saw are caused by the SDK's internal API issue.

While sentry-rails does have dependency requirement, versions before 5.4.0 require sentry-ruby-core, which was deprecated in 5.4.0. So in this case upgrading sentry-ruby solely will still pass the dependency resolution:

    sentry-rails (5.3.1)
      railties (>= 5.0)
      sentry-ruby-core (~> 5.3.1)
    sentry-ruby (5.4.1)
      concurrent-ruby (~> 1.0, >= 1.0.2)

Can you make sure you have both sentry-ruby and sentry-rails (or just declare sentry-rails) have ~> 5.4.1? It should solve the issue.

@st0012 st0012 removed the Type: Bug label Aug 2, 2022
@st0012
Copy link
Collaborator

st0012 commented Aug 2, 2022

cc @sl0thentr0py

@ckdake
Copy link
Author

ckdake commented Aug 2, 2022

That looks like it does the trick! This upgrade was triggered by dependabot and we missed the sentry-rails piece somehow. Should sentry-ruby have a hard dependency on version of sentry-rails it needs?

@st0012
Copy link
Collaborator

st0012 commented Aug 2, 2022

sentry-ruby shouldn't require sentry-rails because not all users need Rails integration. It should be other way around, which we already do.
This issue is because of the deprecation of the old sentry-ruby-core dependency so I think it's a one time thing for this upgrade. Sorry for the convenience though I didn't see it coming and I don't think there's a clean way to prevent it either 😥

@ckdake
Copy link
Author

ckdake commented Aug 2, 2022

Ah right, plenty of ruby solo out there! Thanks for investigating, glad we figured it out.

@ckdake ckdake closed this as completed Aug 2, 2022
ollietreend added a commit to alphagov/whitehall that referenced this issue Aug 15, 2022
This commit bumps all three Sentry gems used by this project to version 5.4.1.

An internal API change was made in the Sentry gems which means 5.3.x gems aren't compatible with 5.4.x gems.

If all three gems aren't updated at the same time, we end up with test failures containing error messages like this:

```
exception expected, not
Class: <ArgumentError>
Message: <"wrong number of arguments (given 1, expected 2)">
```

For further details, see getsentry/sentry-ruby#1859 and getsentry/sentry-ruby#1865.
BeckaL added a commit to alphagov/link-checker-api that referenced this issue Aug 16, 2022
This commit bumps all three Sentry gems used by this project to version 5.4.1.

An internal API change was made in the Sentry gems which means 5.3.x gems aren't compatible with 5.4.x gems.

If all three gems aren't updated at the same time, we end up with test failures containing error messages like this:

```
exception expected, not
Class: <ArgumentError>
Message: <"wrong number of arguments (given 1, expected 2)">
```

For further details, see getsentry/sentry-ruby#1859 and getsentry/sentry-ruby#1865.
BeckaL added a commit to alphagov/transition that referenced this issue Aug 16, 2022
This commit bumps all three Sentry gems used by this project to version 5.4.1.

An internal API change was made in the Sentry gems which means 5.3.x gems aren't compatible with 5.4.x gems.

If all three gems aren't updated at the same time, we end up with test failures containing error messages like this:

```
exception expected, not
Class: <ArgumentError>
Message: <"wrong number of arguments (given 1, expected 2)">
```

For further details, see getsentry/sentry-ruby#1859 and getsentry/sentry-ruby#1865.
kevindew added a commit to alphagov/manuals-publisher that referenced this issue Aug 16, 2022
This is required for compatibility with the other sentry dependency
bumps. See: getsentry/sentry-ruby#1859
kevindew added a commit to alphagov/publishing-api that referenced this issue Aug 16, 2022
This is required for compatibility with the other sentry dependency
bumps. See: getsentry/sentry-ruby#1859
@adipasquale
Copy link

👍 thank you for the investigation and solution.
It took me a few days to realize I was not receiving events anymore, and a few hours before understanding where the problem came from and landing on this issue. Happy to learn it should be a one time thing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants