Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove async from SNITcpHandle#2915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
cheenamalhotra merged 8 commits intodotnet:mainfromDavid-Engel:parallel
Oct 22, 2024

Conversation

David-Engel
Copy link
Contributor

*For easier code review, hide whitespace changes in this PR.

In our quest to remove async use on sync paths, I've refactored parallel connections in SNITcpHandle.cs. The new code leverages non-blocking sockets and Socket.Select in a single thread to connect in parallel.

To test, I created multiple semi-random entries in my local hosts file like:

127.0.0.1test-msf::2test-msf193.168.176.1test-msf11.13.99.44     test-msf

And used the following TCPConnectionString in config.json:
Data Source=tcp:test-msf;Database=Northwind;User=sa;Password=...;Encrypt=false;MultiSubnetFailover=true;

Here is a snippet of traces from SNITcpHandle for a failed run (invalid port:Data Source=tcp:test-msf,1444):

SNICommon.GetDnsIpAddresses | INFO | Getting DNS host entries for serverName test-msf.SNITCPHandle.ParallelConnect | INFO | Connecting to IP address 128.0.0.1 and port 1444 using InterNetwork address family. Is infinite timeout: FalseSNITCPHandle.ParallelConnect | INFO | Connecting to IP address 193.168.176.1 and port 1444 using InterNetwork address family. Is infinite timeout: FalseSNITCPHandle.ParallelConnect | INFO | Connecting to IP address 11.13.99.44 and port 1444 using InterNetwork address family. Is infinite timeout: FalseSNITCPHandle.ParallelConnect | INFO | Connecting to IP address 10.12.0.1 and port 1444 using InterNetwork address family. Is infinite timeout: FalseSNITCPHandle.ParallelConnect | INFO | Connecting to IP address ::2 and port 1444 using InterNetworkV6 address family. Is infinite timeout: FalseSNITCPHandle.ParallelConnect | INFO | Determining the status of sockets during the remaining timeout of 47710000 microseconds.SNITCPHandle.ParallelConnect | INFO | Failed to connect to endpoint: ::2. Error: nullSNITCPHandle.ParallelConnect | INFO | Determining the status of sockets during the remaining timeout of 47709000 microseconds.SNITCPHandle.ParallelConnect | INFO | Failed to connect to endpoint: 10.12.0.1. Error: nullSNITCPHandle.ParallelConnect | INFO | Determining the status of sockets during the remaining timeout of 34270000 microseconds.SNITCPHandle.ParallelConnect | INFO | Failed to connect to endpoint: 128.0.0.1. Error: nullSNITCPHandle.ParallelConnect | INFO | Determining the status of sockets during the remaining timeout of 26904000 microseconds.SNITCPHandle.ParallelConnect | INFO | Failed to connect to endpoint: 193.168.176.1. Error: nullSNITCPHandle.ParallelConnect | INFO | Determining the status of sockets during the remaining timeout of 26858000 microseconds.SNITCPHandle.ParallelConnect | INFO | Failed to connect to endpoint: 11.13.99.44. Error: nullSNITCPHandle.ParallelConnect | INFO | Disposing non-selected socket for endpoint: 128.0.0.1SNITCPHandle.ParallelConnect | INFO | Disposing non-selected socket for endpoint: 193.168.176.1SNITCPHandle.ParallelConnect | INFO | Disposing non-selected socket for endpoint: 11.13.99.44SNITCPHandle.ParallelConnect | INFO | Disposing non-selected socket for endpoint: 10.12.0.1SNITCPHandle.ParallelConnect | INFO | Disposing non-selected socket for endpoint: ::2SNITCPHandle.ParallelConnect | ERR | No connections succeeded. Last error: null

Here is a snippet of traces from SNITcpHandle for a successful run (one valid IP):

SNICommon.GetDnsIpAddresses | INFO | Getting DNS host entries for serverName test-msf.SNITCPHandle.ParallelConnect | INFO | Connecting to IP address 193.168.176.1 and port 1433 using InterNetwork address family. Is infinite timeout: FalseSNITCPHandle.ParallelConnect | INFO | Connecting to IP address 11.13.99.44 and port 1433 using InterNetwork address family. Is infinite timeout: FalseSNITCPHandle.ParallelConnect | INFO | Connecting to IP address 10.12.0.1 and port 1433 using InterNetwork address family. Is infinite timeout: FalseSNITCPHandle.ParallelConnect | INFO | Connecting to IP address 127.0.0.1 and port 1433 using InterNetwork address family. Is infinite timeout: FalseSNITCPHandle.ParallelConnect | INFO | Connecting to IP address ::2 and port 1433 using InterNetworkV6 address family. Is infinite timeout: FalseSNITCPHandle.ParallelConnect | INFO | Watching pending sockets during the remaining timeout of 47724000 microseconds.SNITCPHandle.ParallelConnect | INFO | Connected to endpoint: 127.0.0.1:1433SNITCPHandle.ParallelConnect | INFO | Disposing non-selected socket for endpoint: 193.168.176.1SNITCPHandle.ParallelConnect | INFO | Disposing non-selected socket for endpoint: 11.13.99.44SNITCPHandle.ParallelConnect | INFO | Disposing non-selected socket for endpoint: 10.12.0.1SNITCPHandle.ParallelConnect | INFO | Disposing non-selected socket for endpoint: ::2

saurabh500 reacted with heart emojiedwardneal reacted with rocket emoji
@codecovCodecov
Copy link

codecovbot commentedOct 22, 2024
edited
Loading

Codecov Report

Attention: Patch coverage is77.63975% with36 lines in your changes missing coverage. Please review.

Project coverage is 71.86%. Comparing base(e006d00) to head(f6d0bc7).
Report is 6 commits behind head on main.

Files with missing linesPatch %Lines
...e/src/Microsoft/Data/SqlClient/SNI/SNITcpHandle.cs77.63%36 Missing⚠️
Additional details and impacted files
@@           Coverage Diff           @@##             main    #2915   +/-   ##=======================================  Coverage   71.85%   71.86%           =======================================  Files         294      294             Lines       60287    60330   +43     =======================================+ Hits        43319    43355   +36- Misses      16968    16975    +7
FlagCoverage Δ
addons92.90% <ø> (ø)
netcore75.82% <77.63%> (+<0.01%)⬆️
netfx70.35% <ø> (+<0.01%)⬆️

Flags with carried forward coverage won't be shown.Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

@cheenamalhotracheenamalhotra merged commit1c04120 intodotnet:mainOct 22, 2024
124 checks passed
@David-EngelDavid-Engel deleted the parallel branchOctober 22, 2024 19:17
@mdaiglemdaigle added the Code Health 💊Issues/PRs that are targeted to source code quality improvements. labelOct 23, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@edwardnealedwardnealedwardneal left review comments

@cheenamalhotracheenamalhotracheenamalhotra approved these changes

Assignees
No one assigned
Labels
Code Health 💊Issues/PRs that are targeted to source code quality improvements.
Projects
None yet
Milestone
6.0-preview2
Development

Successfully merging this pull request may close these issues.

4 participants
@David-Engel@cheenamalhotra@edwardneal@mdaigle

[8]ページ先頭

©2009-2025 Movatter.jp