Move session creation out of worker threads: the session open can race with connection close.
Merge branch 'develop' into log-cursor