As with #4465, be careful to reserve a db connection before acquiring a lock, instead of trying to obtain a connection within the critical section as this might lead to a deadlock.
Authored by: cboos 2010-04-05
Parent: [r9438]
Child: [r9440]