Hi,
Apache's Jira seems to be down currently, but I wanted to provide
some feedback about issue JCR-645 (DatabasePersistenceManager &
DatabaseFileSystem: try to gracefully recover from connection loss).
We tested this fix inside 1.2RC2 with a MySQL database server.
The reconnection/retry mechanism in DatabasePersistenceManager seems
to behave fine when the connection times out or is killed for some
reason, but the DB server is in fact still running.
However there is a problem if the connection cannot be re-established
directly, for example if a transient network outage lasts longer than
the few reconnection attempts.
Inside DatabasePersistenceManager.reestablishConnection(),
initConnection() will fail, and the preparedStatements map will stay
empty.
This in turn will trigger a nasty NullPointerException (never caught)
next time executeStmt() is called, because the map is still empty,
and there is no check for that.
I guess a dumb fix would be to maintain some state in initConnection
(), check it in executeStmt(), and maybe attempt to
reestablishConnection() if it's down, just in case the database
server has become available again. But I've haven't tested this yet,
and may be missing something.
Would it be possible to still include a fix for this in 1.2?
Thanks a lot!
Olivier Dony
PS: I suppose I can provide a patch for this if it helps, but Stefan
has a better view of this stuff.