sentry-ruby
sentry-ruby copied to clipboard
Unexpected Database Connection with wrong credentials when using sentry-rails
Issue Description
Using
# config/initializers/sentry.rb
Sentry.init do |config|
config.dsn = 'https://…' unless Rails.env.test?
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for tracing.
# We recommend adjusting this value in production.
config.traces_sample_rate = 1.0
# or
# config.traces_sampler = lambda do |_context|
# true
# end
# Set profiles_sample_rate to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
config.profiles_sample_rate = 1.0
end
and starting the app (rails s
) we suddenly got
Host '10.0.0.1' is blocked because of many connection errors; unblock with 'mariadb-admin flush-hosts' (Mysql2::Error)
Taking a look into the MySQL logs unveiled
Aug 28 11:25:15 server mariadbd[913]: 2024-08-28 11:25:15 10232 [Warning] Aborted connection 10232 to db: 'unconnected' user: 'unauthenticated' host: '10.0.0.1' (This connection closed normally without authentication)
Without Sentry.init
we don't see that problem. DB and User in Log message are unaltered, and do not match up with configured credentials.
And I'm quite confused how something could trigger this, cause the database seems to be initialised and not initialised at the same time. Database-Server-IP is used, but Database-Credentials aren't. I'm also missing a good starting point to debug this further.
I'm not really sure this is a problem related to sentry, or the way sentry integrates itself into rails, but somehow it's triggered by the integration.
Note: IP of DB-Host was altered here, but it should be mentioned that the database doesn't run on localhost
Reproduction Steps
I don't know yet.
Expected Behavior
No error? What ever tries to connect to the database should only after connection is initialised by active record?
Actual Behavior
Something triggers a database connection with no or wrong credentials.
Ruby Version
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [arm64-darwin22]
SDK Version
sentry-ruby (5.19.0)
Integration and Its Version
sentry-rails (5.19.0), rails (6.1.7.8)
Sentry Config
No response