Logstash does not reconnect when DB2 "SqlNonTransientConnectionException" is raised
edmocosta opened this issue · 0 comments
This problem is caused when a connection gets closed by DB2 (idle sessions, workload rules, network issues, etc.)
Logstash should gracefully recover from those errors, discarding the stale connection and reconnecting the client. Instead, the plugin hangs trying to reuse the closed connection.
This issue probably started after changed the connection pattern to pooling (PR). As a workaround, we can enable the jdbc_validate_connection and set the jdbc_validation_timeout to a smaller interval value compared to the schedule option, E.g:
....
schedule => "*/5 * * * *" #5 minutes
jdbc_validate_connection => true
jdbc_validation_timeout => 270 #4.5 minutes
The plugin documentation should also include a note, instructing that the jdbc_validation_timeout
should be smaller than the schedule
period, otherwise the :validate_connection
extension won't work.
The problem seems to be on the sequel
gem adapters/jdbc#disconnect_error? method. This specific exception is not being wrapped into another exception, letting the :cause
nil, not detecting the disconnection (jeremyevans/sequel#2083).