You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Microsoft.Data.SqlClient.SNI.x64.dll crashes when using multiple AppDomains in IIS Express and IIS Server #1418
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):
Program.
Application Error
Event ID 1000
Navn på program med fejl: iisexpress.exe, version: 10.0.22377.1000, tidsstempel: 0x8db0c0a2
Navn på modul med fejl: Microsoft.Data.SqlClient.SNI.x64.dll, version: 4.0.0.0, tidsstempel: 0x61953095
Undtagelseskode: 0xc0000409
Forskydning med fejl 0x000000000001c80c
Proces-id 0xff14
Programmets starttidspunkt 0x01d7e767da588b02
Programsti: C:\Program Files\IIS Express\iisexpress.exe
Modulsti: C:\Users\mora\AppData\Local\Temp\Temporary ASP.NET Files\vs\1453ae1f\938c099f\assembly\dl3\7084a998\0061005c_e1dcd701\Microsoft.Data.SqlClient.SNI.x64.dll
Rapport-id: a6347776-fe45-45b4-a202-d971b9ac10a9
Fuldt navn på program med fejl:
Relativt program-id for program med fejl:
Exception message:
None
Stack trace:
None
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.
I can't reproduce with a new project.
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.
Reacted by Peter Palotas, Will Fuqua, Andrew Timson, Taylor Buchanan and MaceWindu
@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.
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.
I have not yet experienced the crash while in Visual Studio with debugger attached. I have seen the
crash on a Server 2019 with SQL 2019 and also on a Server 2019 with SQL 2017.
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.
Also seeing this, on Windows 10, .NET Framework with Encrypt=False. It's not just IISExpress; it's also crashing w3wp.exe (as @jaymonson's earlier log showed).
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.
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.
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.
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.
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.
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
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
@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?
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.
In your release note it was said "Updated Microsoft.Data.SqlClient.SNI (.NET Framework dependency) and Microsoft.Data.SqlClient.SNI.runtime (.NET Core/Standard dependency) version to 5.0.1 #1795, which includes the fix for AppDomain crash introducing in issue #1418."
Does it mean you have not updated the SNI dlls for .Net framework 4.x yet?
Activity
JRahnama commentedon Dec 8, 2021
@MojoDK have you tried to manually copy paste the required dll and see if that works?
MojoDK commentedon Dec 9, 2021
@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.
JRahnama commentedon Dec 9, 2021
@MojoDK are you able to reproduce the issue with a simple newly created application? or can you provide a repro please?
leonmeijer commentedon Jan 11, 2022
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.
jaymonson commentedon Jan 11, 2022
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
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: 0x228c
Faulting application start time: 0x01d7f3989332762e
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: C:\inetpub\wwwroot\C2SWeb\C2SWebAdministrator\bin\Microsoft.Data.SqlClient.SNI.x64.dll
Report Id: 3b4dba21-3703-43ee-9ad7-fdd3c0b15863
Faulting package full name:
Faulting package-relative application ID:
I have not yet experienced the crash while in Visual Studio with debugger attached. I have seen the
crash on a Server 2019 with SQL 2019 and also on a Server 2019 with SQL 2017.
JRahnama commentedon Jan 11, 2022
@leonmeijer and @jaymonson are you on Windows 11 as well and the issue does not happen when downgrading to
Microsoft.Data.SqlClientv3?jaymonson commentedon Jan 11, 2022
tdhintz commentedon Jan 11, 2022
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.
leonmeijer commentedon Jan 11, 2022
tdhintz commentedon Jan 11, 2022
For the record, our test environments are typically Encryption true, certificates trusted.
waf commentedon Jan 14, 2022
Also seeing this, on Windows 10, .NET Framework with
Encrypt=False. It's not just IISExpress; it's also crashing w3wp.exe (as @jaymonson's earlier log showed).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 Entry
agclark27 commentedon Jan 24, 2022
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.
JRahnama commentedon Jan 24, 2022
@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?
agclark27 commentedon Jan 24, 2022
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.
JRahnama commentedon Jan 24, 2022
Have you tested this issue?
This blog could be helpful as well.
45 remaining items
lcheunglci commentedon Aug 30, 2022
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.
isandburn commentedon Sep 13, 2022
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
lcheunglci commentedon Sep 13, 2022
Yes, the fix will resolve this issue. As the issue lies in the
registerProviderSNI method when registering the same provider more than once.DavoudEshtehari commentedon Sep 15, 2022
The PR has been merged and will be in the next release.
isandburn commentedon Sep 15, 2022
@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?
DavoudEshtehari commentedon Sep 15, 2022
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.
Release Notes
gregpakes commentedon Sep 21, 2022
@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
DavoudEshtehari commentedon Sep 22, 2022
@gregpakes Yes, 5.1 is on the plan to be released this year.
tdhintz commentedon Sep 29, 2022
A patch for 5.0 is needed asap as well.
JRahnama commentedon Sep 29, 2022
@tdhintz we are planning on a hotfix of 5.0.1. Date yet to be decided.
tdhintz commentedon Sep 30, 2022
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.
DavoudEshtehari commentedon Oct 11, 2022
I'm glad to announce that Microsoft.Data.SqlClient v5.0.1 has been released.
xiangdguo commentedon Jan 7, 2025
We are still seeing the same exception in Windows Event Log with MDS 5.2 as below.
Faulting module name: Microsoft.Data.SqlClient.SNI.x86.dll, version: 5.2.0.0, time stamp: 0x65d526aa
Exception code: 0xc0000409
Fault offset: 0x000013fb
Microsoft.Data.SqlClient version: 5.2.2
.NET target: .NET Framework 4.7.2,
SQL Server version: SQL Server 2017
Operating system: Windows Server 2019
xiangdguo commentedon Jan 14, 2025
Hi @DavoudEshtehari
In your release note it was said "Updated Microsoft.Data.SqlClient.SNI (.NET Framework dependency) and Microsoft.Data.SqlClient.SNI.runtime (.NET Core/Standard dependency) version to 5.0.1 #1795, which includes the fix for AppDomain crash introducing in issue #1418."
Does it mean you have not updated the SNI dlls for .Net framework 4.x yet?