Don't start a session if it's known to be empty.

If an app only reads/checks the session there's no need to start a
session to know that the read/checked session value is empty.

Fixes #1981
Avoid code duplication.
Merge pull request #2693 from ADmad/2.5-session-start

Don't start a session if it's known to be empty.