Issue #20044 fix session error handling bug.
issue #20044: Lots of fixes, linting other clean up.
Merge remote-tracking branch 'JOHN/20044' into 20044