Open jesanfafon opened 2 years ago
@jesanfafon is it possible to try without MultipleActiveResultSets=True;
or set it to MultipleActiveResultSets=false;
@JRahnama I tried running the app with that set to false
; it looks like the team is using a library for graphql that requires MARS enabled.
If you think that it has a high chance of fixing our issues, we can try isolating part of the app to verify.
Any other ideas?
In doing some more testing today, the application works fine when connected directly to the primary server of the availability group by ip address. It appears to be only when using the listener endpoint that this issue occurs.
@jesanfafon this makes me wonder if you need to have same certificate or a valid certificate on each server? Do you have that setup and working?
@JRahnama we doublechecked the certs on our testing database and issued new ones but are seeing the same issue with the new certs
@jesanfafon I am going to setup an environment as yours, not sure if it is doable on my side, but that would be time consuming. I most probably will report back here somewhere next week. Just quick reminder of the Note
part in this MS docs.
Good to hear! I spent some time with our Ops team on Friday working through the certificate requirements in that Note
in the docs. We weren't able to get that configured correctly, but should that matter with TrustServerCertificate
enabled? We're able to connect to either member of the availability group on its own, but not if both servers are listed in the DNS entry (as is the case with an availability group listener).
I'll keep working with our Ops team to get this configured correctly, since it is a more correct configuration. I'm unclear on what behavior it would change, and why our .NET Framework apps can connect to the same cluster without issue.
Is there any chance porting this application to Windows might resolve the issue?
Was there a resolution to this issue? We're seeing this as well. We use entity framework and make about 13 or so quick DB counts and it keeps erroring within the step with this error. We're using .net 6, and system.data.sqlclient
@ssadiq1 which System.Data.SqlClient version?
@ssadiq1 which System.Data.SqlClient version? 4.8.4
What was the resolution to this? I am encountering this too. Hello @jesanfafon @JRahnama
What we wound up doing for our applications is building a secondary tool that watches the Availability Group Endpoint and updates the membership of our writable servers in a load balancer.
Then, the applications that have issues with connecting to the endpoint (e.g. dotnet on linux, nodejs, etc) can connect to the load balancer instead.
I can probably get permission to open source the code that's watching the endpoint if you're interested in that.
Describe the bug
We're hosting a dotnet core 3.1 app on Linux in kubernetes. It presently connects successfully to a SQL Server 2014 instance, but we're consolidating onto a SQL Server 2014 Availability Group cluster. When the application tries to connect to the Availability Group Listener, it is initially successful, but on subsequent calls we frequently get the included exception.
Suspecting this might be a diagnosable protocol and/or platform issue, we ran wireshark on the primary instance of the SQL Server availability group. Wireshark doesn't show much because the connection to the server is being encrypted, but it does show that as long as TCP sessions don't enter their idle state, the app is able to successfully reuse them. If the TCP session idles, the app sends a tcp syn packet, which the server responds to correctly, but the app resets the connection and returns the included stack trace. Other than that detail, the overall network traffic looks like a normal encrypted SQL Server connection.
This is our only dotnet core application connecting to sql server that runs on Linux, so we've not been able to identify what the issue is.
Further technical details
Microsoft.Data.SqlClient version: 4.0.0 (also happens on 3.0.1) .NET target: Core 3.1 SQL Server version: SQL Server 2014 Operating system: Docker Container,
mcr.microsoft.com/dotnet/aspnet:3.1
We're using the OpenSSL mitigations outlined in https://github.com/dotnet/runtime/issues/30667 Connection string:Data Source=<sql AG Listener endpoint>; Initial Catalog=<our database>; User ID=<our uid>; Connect Timeout=120; MultipleActiveResultSets=True; MultiSubnetFailover=True; TrustServerCertificate=true;