hi olivier,
On 1/17/07, Olivier Dony <[EMAIL PROTECTED]> wrote:
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.
doh! probably the simplest fix would be to remove line 783 in
DatabasePersistenceManager.java and line 1010 in
DatabaseFileSystem.java,
i.e. the following stmt:
preparedStatements.clear();
if you have a chance to successfully test this i'll commit the change asap.
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?
i guess jukka will have to decide this.
thanks for reporting this issue and for the excellent problem analysis.
cheers
stefan
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.