On behalf of  shijunjuan: Handling possible IllegalStateException while cleaning orphaned and timed out sessions. Fixes issue 6771