-
Notifications
You must be signed in to change notification settings - Fork 286
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
Microsoft.Data.SqlClient.SNI.x64.dll crashes when using multiple AppDomains in IIS Express and IIS Server #1418
Comments
@MojoDK have you tried to manually copy paste the required dll and see if that works? |
@JRahnama the "Microsoft.Data.SqlClient.SNI.x64.dll" is already in the bin folder - if I copy (overwrite) it with another "Microsoft.Data.SqlClient.SNI.x64.dll" file, the error is the same. |
@MojoDK are you able to reproduce the issue with a simple newly created application? or can you provide a repro please? |
We're having the same issue. For us it happens in an application with multiple app domains. When the second app domain loads and begins doing a database function, the application crashes hard with no stack trace in Visual Studio. We have the same error codes in Event Viewer. Downgrading to v3 resolved it for now. |
We are having the same issue. It is intermittent but at times can occur frequently. When it occurs we get the following crashstack: Faulting application name: w3wp.exe, version: 10.0.17763.1, time stamp: 0xcfdb13d8 I have not yet experienced the crash while in Visual Studio with debugger attached. I have seen the |
@leonmeijer and @jaymonson are you on Windows 11 as well and the issue does not happen when downgrading to |
Hi,
I have not tried it on Windows 11. I have seen it on 2 different Server 2019 systems. I have not yet tried the downgrade to v3 as that would not
be an option for us as we try to stay with the latest/greatest/current versions as much as possible. But I can try the downgrade when I get a chance.
Thanks,
Jay
From: Javad ***@***.***>
Sent: Tuesday, January 11, 2022 11:40 AM
To: dotnet/SqlClient ***@***.***>
Cc: Jay Monson ***@***.***>; Mention ***@***.***>
Subject: Re: [dotnet/SqlClient] Microsoft.Data.SqlClient.SNI.x64.dll crashes iisexpress (Issue #1418)
[External email: Use caution! Do not open attachments or click on links from unknown senders or unexpected emails.]
@leonmeijer<https://protect-us.mimecast.com/s/A8_qCADAYoIZZ0zyC8JsII?domain=github.com> and @jaymonson<https://protect-us.mimecast.com/s/TdOzCBBQYpuDDqOQCNwC37?domain=github.com> are you on Windows 11 as well and the issue does not happen when downgrading to Microsoft.Data.SqlClient v3?
—
Reply to this email directly, view it on GitHub<https://protect-us.mimecast.com/s/GxVlCzp9w5IGGDAlu4ZO0k?domain=github.com>, or unsubscribe<https://protect-us.mimecast.com/s/KrkNCDkPVrfoopk2cZ5AoD?domain=github.com>.
Triage notifications on the go with GitHub Mobile for iOS<https://protect-us.mimecast.com/s/n8-nCERGVvullyNrcZYkBb?domain=apps.apple.com> or Android<https://protect-us.mimecast.com/s/GJy0CG6gVxsBBnQxu0Mf_g?domain=play.google.com>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
The @jaymonson issue occurs on a redirect. It didn't happen on the latest System.Data.SqlClient, but it does on Microsoft.Data.SqlClient. It feels like it is losing some sort of thread context. |
I have the issue with v4 on Server 2016, 2022, Windows 10 and 11. Tried with SQL Server 2016. Happens with and without Visual Studio.
Does not happen with v3
Outlook voor Android<https://aka.ms/AAb9ysg> downloaden
…________________________________
From: Hintz ***@***.***>
Sent: Tuesday, January 11, 2022 7:26:58 PM
To: dotnet/SqlClient ***@***.***>
Cc: Leon Meijer ***@***.***>; Mention ***@***.***>
Subject: Re: [dotnet/SqlClient] Microsoft.Data.SqlClient.SNI.x64.dll crashes iisexpress (Issue #1418)
The @jaymonson<https://github.com/jaymonson> issue occurs on a redirect. It didn't happen on the latest System.Data.SqlClient, but it does on Microsoft.Data.SqlClient. It feels like it is losing some sort of thread context.
—
Reply to this email directly, view it on GitHub<#1418 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AA6N3SY3BYFYWDBRJWOURYTUVRY7FANCNFSM5JG3OPHQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
For the record, our test environments are typically Encryption true, certificates trusted. |
Also seeing this, on Windows 10, .NET Framework with Happening for all members of our development team. When debugging from Visual Studio the first time after building it crashes; after crashing once it then starts OK on subsequent debug launches until the next build. Event Log EntryFaulting application name: w3wp.exe, version: 10.0.19041.1, time stamp: 0x58c67bf3 Faulting module name: Microsoft.Data.SqlClient.SNI.x64.dll, version: 4.0.0.0, time stamp: 0x61953095 Exception code: 0xc0000409 Fault offset: 0x000000000001c80c Faulting process id: 0x6f7c Faulting application start time: 0x01d8091b05a21bbc Faulting application path: c:\windows\system32\inetsrv\w3wp.exe Faulting module path: C:\Projects\web\lib\Microsoft.Data.SqlClient.SNI.x64.dll Report Id: 6e33d06d-be0e-4496-b5dd-f82c5285eb01 Faulting package full name: Faulting package-relative application ID: |
We're observing the same crashes of w3wp.exe with the same exception code and fault offset in Microsoft.Data.SqlClient.SNI.x64.dll. We checked all of our Splunk logs, and the issue wasn't present when we were on 3.x, but it immediately began appearing with 4.0.0 and remains present in 4.0.1. |
@waf and @agclark27 is it happening with a fresh build application even? Can you make a minimal repro with the issue happening and send it to us? |
Yes, it'll happen throughout the day, even with fresh builds, and we're resetting the IIS app pool overnight each day. There are no memory pressure issues on the servers at the time the crashes occur. I'll see if we can attach DebugDiag to these to get a stack trace when the process crashes. |
Have you tested this issue? |
Mind that I have this issue in a Console/Desktop application, not using wp3wp at all |
Since today I see the same issue occur on servers I manage, but then in the Microsoft Monitoring Agent. Faulting application name: MonitoringHost.exe, version: 10.20.18053.0, time stamp: 0x5f8bacc8 |
@leonmeijer can you provide a stand alone repro please? |
@JRahnama I was able to create a repro of this problem, though not involving IISExpress it sounds similar to the scenario described by @leonmeijer, which is also the problem we we're seeing, and I suspect it has the same underlying cause. Here is a small standalone repro that exhibits this problem when using AppDomains in .NET Framework 4.8: Program.cs: using System;
using Microsoft.Data.SqlClient;
namespace ConsoleApp1
{
public class Program
{
public const string ConnectionString = "Data Source=.;Initial Catalog=SinT.feature/sqlClient.ProtectionTest;Integrated Security=SSPI;Multiple Active Result Sets=True;Encrypt=False;Multi Subnet Failover=False";
public class DbTest : MarshalByRefObject
{
public void Call()
{
using (SqlConnection conn = new SqlConnection(ConnectionString))
{
Console.WriteLine("Open connection");
conn.Open();
}
}
}
static void Main(string[] args)
{
Console.WriteLine($"Start using {typeof(SqlConnection).Assembly.FullName}");
AppDomain domain = AppDomain.CreateDomain("MyDomain");
using (SqlConnection conn = new SqlConnection(ConnectionString))
{
Console.WriteLine("Open connection");
conn.Open();
DbTest dbTest = (DbTest)domain.CreateInstanceAndUnwrap(typeof(DbTest).Assembly.FullName, typeof(DbTest).FullName);
try
{
dbTest.Call();
}
catch (Exception)
{
Console.WriteLine("Error");
}
Console.WriteLine("All calls done");
}
}
}
} ConsoleApp1.csproj: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net48</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.1.0" />
</ItemGroup>
</Project> And below is the output when running it, first with version 3.0.1 of Microsoft.Data.SqlClient, and then with version 4.1.0 (run on Windows 10 with latest updates in this scenario, but problem also observed on Windows Server 2019 and 2022)
The event log contains the following error entry after the second execution:
If running from Visual Studio with Native Debugging enabled and break on exceptions, we can see the following exception text at the call to
|
@alphaleonis I tried your repro by adding |
We are having the same issue as described by @alphaleonis. We are loading multiple appdomains in a Windows Service and executing EF queries and after we updated our dependencies our app is now crashing if 2 app domains are simultaniously making queries to the database.
With the code that can reproduce the issue provided by @alphaleonis is there an update yet on this issue? This should be regarded as a high priority bug IMHO. Edit I reverted my package version of |
@JRahnama |
We recently upgraded our ASP.NET / .NET Framework 4.8 web app to use Microsoft.Data.SqlClient Version 4.1 and Microsoft.Data.SqlClient.SNI Version 4.0. The new package worked fine locally and in our development environment, but when we deployed our app to our QA server the IIS application pool immediately crashes when starting up:
We upgraded primarily because we lost SQL statement logging using Application Insights with Microsoft.Data.SqlClient 3.0 and upgrading to 4.0 seemed to fix it. |
We are experiencing the same issue of crashing the process (w3wp) due to exception in Microsoft.Data.SqlClient.SNI. We use Microsoft.Data.SqlClient (4.1) and Microsoft.Data.SqlClient.SNI (4.0). The OS is Windows Server 2016 and Framework is 4.7.2.
This issue has become very critical as it is happening in production environment and we had to rollback the deployment. This crash does not happen on any other SIT or UAT environments. |
Would it be possible to get an update on this issue? We upgraded to Microsoft.Data.SqlClient 3.1 so we could take advantage of Active Directory Default authentication. Unfortunately, 3.1 broke Application Insights SQL telemetry as described here: #1258 The only way we can use Active Directory Default and restore AI SQL telemetry is to upgrade to 4.1, but it's crashing our w3wp.exe process. I would also submit that the title of this issue should be change. This issue doesn't only affect IIS Express. It impacts web applications running under IIS as well. |
Or any other application using SqlClient from multiple AppDomains actually. |
The MDS v5.0.0 just went live, and I tried the 3 sample projects provided here: #1418 (comment) , #1418 (comment) , and |
@lcheunglci We're still seeing the crash in v5.0.0 with the sample projects provided. With #1418 (comment) as an example, it's still crashing on both x32 and x64 as shown below. The reproduction of the crash when using multiple appdomains is pretty consistent, but since most of the repros are console apps, you may not be seeing the crash unless you're looking in the event log or output, since it blows up the whole process. This is an issue not just for console apps but also for any use in IIS which makes regular use of appdomains with a .NET Framework app.
|
Sorry, I realized that I was testing a 5.0 dev SNI build, which worked. I just re-tried all 3 repro samples again using |
I did some research and found the difference between my local environment and the environment on the pipeline that generates the SNI GA build. I found out that I was using an older version of the Windows 10 SDK |
Thanks for the information on the cause. This would specifically only impact the SNI package/build, correct? (I verified that v3.1.1 of MDS built 5 days ago works. If it only impacts the SNI package, then that would make sense, because that wasn't revved - it's still using v3.0.0 from June 2021.) |
Yes, this only impacts the SNI nuget package, but from my knowledge, it usually released in sync with a MDS release. |
Yes, SNI releases are (usually) synced to an MDS release, but not every MDS release has an SNI release. None of the 3.x or 4.x MDS patches have a corresponding SNI release, just 3.0.0, 4.0.0, and 5.0.0. |
Please backport to 4.0 as well, as we cannot uptake a non-LTS release. |
Same repro on Windows 10 running IIS and Visual Studio 2022 17.3 Faulting application name: w3wp.exe, version: 10.0.19041.1, time stamp: 0x58c67bf3 |
Any progress on this? On my local dev system (Windows 10) I am experiencing both the memory leak (There is insufficient system memory in resource pool default to run this query) AND the SNI crash. |
Any news on this? Isn't it same bug as #1687? |
I'm not sure if this will resolve the memory leak that you're encountering, but for the SNI crash fix is currently in review and once it's merged, it will be included in the next 5.0 hotfix release.
No, #1687 is a different issue and the fix from here won't resolve the unloading issue. |
Not to belabor the issue, but I think that I too have been experiencing this issue... below is the abbreviated stacktrace I am seeing when debugging the static crash data in VS 2022. @lcheunglci - Could you (or someone) please verify that this is in fact the same issue being addressed in the coming 5.0 hotfix? This also may help others identify is this is in fact their issue as well. Any/All help is greatly appreciated. EDIT: adding @DavoudEshtehari
|
Yes, the fix will resolve this issue. As the issue lies in the |
The PR has been merged and will be in the next release. |
@DavoudEshtehari - that's great news, thank you. unfortunately i am not familiar with your release cadence - do you have any estimation on when i may expect next release? |
Two recent hotfixes 4.0.2 and 4.1.1 ship this fix. And, the next version 5.1 will be released till end of this year. |
@DavoudEshtehari - We are experiencing this issue and we are using 5.0.0. When you said 5.1 will be released by the end of the year - did you mean that? I guess I'll have to use 4.1.1 |
@gregpakes Yes, 5.1 is on the plan to be released this year. |
A patch for 5.0 is needed asap as well. |
@tdhintz we are planning on a hotfix of 5.0.1. Date yet to be decided. |
Can you give any background that would be useful in understanding the root cause? I have an Win server 2016 running IIS in an x64 app pool on an 8 core virtual. It isn't under much load, yet it seems to crash. The crash occurs about the same time a group of sessions are ended together. |
I'm glad to announce that Microsoft.Data.SqlClient v5.0.1 has been released. |
Describe the bug
In my .NetFramework 4.8 web app, I "Start Wihout Debugging" and everything works fine, bu when I rebuild the project, I get the errror below. I have to "Start Without Debugging" again, to make the website work again (and then it crashes againg when rebuilding etc).
From event viewer (sorry it is in Danish):
To reproduce
Include a complete code listing (or project/solution) that we can run to reproduce the issue.
Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.
Expected behavior
Not crashing iisexpress.exe and let me build and refresh the website.
Further technical details
Microsoft.Data.SqlClient version: 4.0.0.0
.NET target: Framework 4.8
SQL Server version: Sql Server 2019
Operating system: Windows 11 Pro x64
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: