-
Notifications
You must be signed in to change notification settings - Fork 1k
CSOM for Core (Microsoft.SharePointOnline.CSOM) causes Socket Exhaustion #7885
Copy link
Copy link
Closed
Labels
Needs: Attention 👋Original poster responded to request for feedback, awaiting attention from Microsoft / community.Original poster responded to request for feedback, awaiting attention from Microsoft / community.area:csom/rest/apiCategory: SharePoint Client Side Object Model SDK / REST APICategory: SharePoint Client Side Object Model SDK / REST APItype:archive-old-issueIssues which are closed as tool old for active workIssues which are closed as tool old for active worktype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.
Metadata
Metadata
Assignees
Labels
Needs: Attention 👋Original poster responded to request for feedback, awaiting attention from Microsoft / community.Original poster responded to request for feedback, awaiting attention from Microsoft / community.area:csom/rest/apiCategory: SharePoint Client Side Object Model SDK / REST APICategory: SharePoint Client Side Object Model SDK / REST APItype:archive-old-issueIssues which are closed as tool old for active workIssues which are closed as tool old for active worktype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
SharePoint CSOM
Developer environment
Windows
What browser(s) / client(s) have you tested
Additional environment details
Describe the bug / error
CSOM Core uses HttpWebRequest, which creates new instances of HttpClient, and could exhausts the available TCP sockets on a system quickly. See references:
To exacerbate the issue, .Net 5 no longer supports System.Net.ServicePointManager, which used to allow us to set the DefaultConnectionLimit, and HttpClient in .Net 5 allows for int.Max of connections per destination server by default. As a result of this combination, under high volume in .Net 5, we need to be able to limit the number of connections per destination server. In .Net 5 and .Net 6, the recommended way to do this is by passing in a SocketsHttpHandler or an HttpClient.
Steps to reproduce
Expected behavior
CSOM core to use HttpClient and allow caller to pass in a HttpMessageHandler (such as SocketsHttpHandler) instead of HttpWebRequest, as recommended in documentation https://docs.microsoft.com/en-us/dotnet/core/compatibility/networking/6.0/webrequest-deprecated