Fix race condition in session pool creation