Long-term sessions are becoming stale, resulting in "no
message" errors on searches. Restarting the app causes
things to work properly again. Is there no support for
reestablishing stale connections, or a way to check for
a stale connection so I can implement my own
reconnection logic?
Not a bug.
OpenLDAP returns "LDAP_SERVER_DOWN" when it can not connect to the LDAP server during an operation.
here is a simple exception handled block that will reconnect to the server after a failed search where the error is LDAP_SERVER_DOWN
again ||= true
begin
var.search2(baseDN, LDAP::LDAP_SCOPE_SUBTREE, filter)
rescue RuntimeError
if ( var.err == LDAP::LDAP_SERVER_DOWN ) && again
var = LDAP::Conn.new(connection_str)
again = false
retry
end
end