-
Notifications
You must be signed in to change notification settings - Fork 293
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
Revert change that made SqlDataReader.ReadAsync()
non-blocking
#547
Revert change that made SqlDataReader.ReadAsync()
non-blocking
#547
Conversation
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs
Show resolved
Hide resolved
@cheenamalhotra still planning a 2.0 preview3 release soon? |
After changing the target framework to .NET Framework 4.8, we started to encounter random MARS errors even though we are not using MARS: Unfortunately there is extremely limited amount of information available, and took us several days to figure out what is happening. The comment of @David-Engel on issue #85 was most helpful to us. Although most official documentation is not listing the change, I remembered that .NET Framework 4.8 Release Notes mentions that Unfortunately the Note that Since enabling the AppContext switch, we have not seen any more MARS errors, but apparently we are using an undocumented switch. Although we haven't tried those, other possible workarounds are targeting a version earlier than .NET Framework 4.8 or not using @cheenamalhotra and @David-Engel, I believe that .NET Framework 4.8 is also affected by this issue (#547). Could you please share whether you have any plans of backporting this fix/revert to .NET Framework 4.8? |
Do you have a repro code available that we can try to reproduce what you observed? |
I could easily reproduce the issue with your test code. I run it in a standalone console application, but I made trivial changes only to remove dependency on the unit testing framework. Your AppDomain has to target .NET Framework 4.8, not just run on .NET Framework 4.8 (or the .dll target it) to have the switch disabled by default. Alternatively, you can disable the switch when running on .NET Framework 4.8, but not targeting it: |
Hi @kornelpal Yes I can reproduce issue with System.Data.SqlClient (default behavior, no custom switches). AppContext.SetSwitch("Switch.Microsoft.Data.SqlClient.MakeReadAsyncBlocking", false); You can find documentation of App Context switches for Microsoft.Data.SqlClient here: https://docs.microsoft.com/en-us/sql/connect/ado-net/appcontext-switches?view=sql-server-ver15. I agree the System.Data.SqlClient switches are not documented well, we'll update our documentation to provide notes for users for transferred switches. In regards to System.Data.SqlClient, since the product is no longer actively maintained but only receives high security issue updates, I'm afraid the default behavior of S.D.S is likely not going to change. I'd recommend you to transition to Microsoft.Data.SqlClient as we actively maintain and deliver new releases and bug fixes here now. |
This PR reverts dotnet/corefx#26595 and #490 (attempted to fix MARS TDS header issues introduced with dotnet/corefx#26595) with additional tests.
This is an alternate solution to fix #542 but due to #544 and #545 failing intermittently on Unix w. Managed SNI, it doesn't seem an appropriate fix either.
This revert is likely to hit performance by re-introducing old behavior of SqlDataReader.ReadAsync() method to run synchronously, and will block the calling thread until data is fed from SQL Server. But given the side-effects of the original change, reverting seems most appropriate at this point and a proper investigation would be needed to be done for original performance issue.