SSO login session timeout

SSO doesn't seem to work correctly after session timeout. If communities page is open and left inactive then after session timeout it shows error "An error occurred. Please try again or contact your administrator. " and can't log back in. If I go to page then I see that I have not logged in. Logging in and then going back to communities fixes the issue till next time.