Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix | TransactionScope connection issue when Enlist is enable, Pooling is disabled and network connection type is Redirect #1960

Merged

Conversation

lcheunglci
Copy link
Contributor

@lcheunglci lcheunglci commented Mar 21, 2023

We found that there was a bug when using a SQL Managed Instance and Azure SQL DB when the connection type is set from proxy to redirect where in the connection string pooling = false and enlist=true would result in Failed: Error Code: 10054 - A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.). By adding a check to ensure RoutingInfo is null before Enlist is called, it resolves the issue.

@lcheunglci lcheunglci added the 🐛 Bug! Something isn't right ! label Mar 21, 2023
@lcheunglci lcheunglci added this to the 5.2.0-preview1 milestone Mar 21, 2023
@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.06 ⚠️

Comparison is base (1bcdb23) 69.72% compared to head (0ba0c82) 69.66%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1960      +/-   ##
==========================================
- Coverage   69.72%   69.66%   -0.06%     
==========================================
  Files         306      306              
  Lines       61563    61563              
==========================================
- Hits        42923    42889      -34     
- Misses      18640    18674      +34     
Flag Coverage Δ
addons 92.38% <ø> (ø)
netcore 73.21% <100.00%> (-0.01%) ⬇️
netfx 67.90% <100.00%> (-0.09%) ⬇️

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

Impacted Files Coverage Δ
...crosoft/Data/SqlClient/SqlInternalConnectionTds.cs 73.25% <100.00%> (ø)
...crosoft/Data/SqlClient/SqlInternalConnectionTds.cs 68.06% <100.00%> (ø)

... and 13 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@lcheunglci lcheunglci changed the title Fix | TransactionScope connection issue when Enlist is enable and SQL MI Connection is set to Redirect Fix | TransactionScope connection issue when Enlist is enable, Pooling is disabled and network connection type is Redirect Mar 22, 2023
@lcheunglci
Copy link
Contributor Author

I find it strange that we do have a test for pooling=false and enlist by default is true, but this test passed before.

public static void ReadNextQueryAfterTxAbortedPoolDisabled(string connString)

@David-Engel
Copy link
Contributor

I find it strange that we do have a test for pooling=false and enlist by default is true, but this test passed before.

public static void ReadNextQueryAfterTxAbortedPoolDisabled(string connString)

The test specifically doesn't run against Azure SQL because Azure SQL used to not support distributed transactions. I think it does now, via elastic transactions. So we probably just need to remove the nameof(DataTestUtility.IsNotAzureServer) from the ConditionalTheory. There might be other tests we can try enabling, too, although I don't know if there is functionality difference between the different .NET versions or if distributed transaction support has all been enabled by changes on the server-side.

@lcheunglci lcheunglci merged commit 0c0ae37 into dotnet:main Mar 23, 2023
131 checks passed
lcheunglci added a commit to lcheunglci/SqlClient that referenced this pull request Mar 23, 2023
…g is disabled and network connection type is Redirect (dotnet#1960)
lcheunglci added a commit to lcheunglci/SqlClient that referenced this pull request Mar 30, 2023
…g is disabled and network connection type is Redirect (dotnet#1960)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug! Something isn't right !
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants