Hello, I have a Rails app that is connecting to a MySQL database through a stateful firewall. The app itself has pretty low volume - about 50 transactions a day at the moment. The problem is that we're seeing the following exception intermittently throughout the day:
Exception Class: Sequel::DatabaseDisconnectError Exception Message: Mysql::Error: Lost connection to MySQL server during query Subsequent transaction attempts on the server work fine. We are initializing Sequel with the following MySQL-specific configuration parameters: :connect_timeout => 7, :read_timeout => 45. Interestingly, the above exception is generated after the read timeout passes (45 seconds) and not on the connect timeout. I assume this is because the database pool has the connection established already. It appears that what is happening is that the database pool connections are being invalidated by the firewall after a certain period of time and when that happens packets belonging to that specific db connection are being dropped by the firewall. It seems me that the best way to handle this is to have the connections in the pool "refresh" or reconnect after a certain period of inactivity that is less than the firewall timeout. I looked at the Sequel documentation and could not find a configuration setting that does this. Is such a setting available? I would rather use a mechanism built into Sequel to handle this as opposed to writing reconnect logic in our app. Also, I am aware of the connection_validator plugin, but it seems that using this plugin would still result in at least a 45 second delay before it realizes that the given connection is invalid and moves on to the next available one. Any help would be appreciated. Thanks, Lon -- 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 http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
