Fix Session_database_driver locking

Ref: #3073