Fix for #21357.

Initiate the session object if it hasn't been created already.