fix #6299: add openSession in getSession when there is no current session