On Monday, April 8, 2019 at 6:57:50 AM UTC-7, Gustavo Sobral wrote: > > Hi, > > I have a Sinatra app with Sequel and Postgres adapter running in a Phusion > Passenger server and I'm facing around 50~60 > Sequel::DatabaseDisconnectError exceptions a day. These exceptions have > mainly three messages on it: > > PG::UnableToSend: SSL error: decryption failed or bad record mac > PG::UnableToSend: SSL SYSCALL error: EOF detected > PG::UnableToSend: PQconsumeInput() SSL error: decryption failed or bad > record mac > > This is my file responsible for initializing Sequel, I've already tried > without success to use the connection_validation extension: > > # frozen_string_literal: true > > # TZ settings > Sequel.application_timezone = 'Amsterdam' > Sequel.database_timezone = :utc > > # Json serializer plugin > Sequel::Model.plugin :json_serializer > > # Global 'DB' handle is a Sequel convention > db_config = YAML.load_file(File.join(Dir.pwd, 'config/database.yml'))[ENV[ > 'RACK_ENV']] > DB = Sequel.connect(db_config) > > # Validate that connections checked out from the pool are still valid, > before yielding them for use > # > http://sequel.jeremyevans.net/rdoc-plugins/files/lib/sequel/extensions/connection_validator_rb.html > DB.extension(:connection_validator > DB.pool.connection_validation_timeout = -1 > > Can anybody shed some light what can possibly be going on here? I'm using > the free version of Phusion Passenger with single-threaded, multi-processed > concurrency model. >
That does look like it should work. The only reason I think it wouldn't is if the disconnects are happening on a connection that has been validated and already been checked out. In that case, there is nothing that Sequel can do about the issue. When the exception is raised, Sequel will remove the connection from the pool, so that a new connection can be established. You could try wrapping everything in a transaction and using the :retry_on option, but a better approach would be to find out why the disconnections are happening in the first place and fix them. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
