Symptoms
SharePointRoleProvider.GetGroups: System.Reflection.TargetInvocationException: An unexpected failure was encountered when contacting SharePoint to get information from the group provider %GROUP_PROVIDER_NAME%: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
Diagnoses
To investigate root cause of this error it is necessary to get log files to see events/errors preceding to this error as well as to get an understanding of how frequently you are getting this error.
Similar error can occur when you have some non working/unavailable SharePoint Group Providers in K2. I.e. one which was deleted/unavailable on SharePoint side (try to navigate to specified URL using K2 service account). To see your configured group providers navigate to K2Workspace > Management Console > User Managers > SP > Group Providers.
But based on error details which say "System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host." It is more likely that error is cause by networking access or permissions issues. So it makes sense to check whether SharePoint site specified for group provider in question is/was reachable from K2 service in context of K2 service account.
Resolution
Based on error details which say "System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host." It is more likely that error is cause by networking access or permissions issues. So it makes sense to check whether SharePoint site specified for group provider in question is/was reachable from K2 service in context of K2 service account.