-
Notifications
You must be signed in to change notification settings - Fork 299
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
Error code 139 when attempting Microsoft.Data.SqlClient connection on Linux with net6.0 #1390
Comments
@rytido thanks for bringing this up. Using UID and PWD will solve the issue. open System
open Microsoft.Data.SqlClient
let connectionString = "Data Source=127.0.0.1;UID=<user name>;PWD=<password>;"
let cnxn = new SqlConnection(connectionString)
exception Error1 of string
try
cnxn.Open()
Console.WriteLine(cnxn.State)
cnxn.Close()
Console.WriteLine(cnxn.State)
with
| Error1(str) -> printfn "Error1 %s" str |
Did Kerberos auth support get dropped? I cannot necessarily use sql server auth. This worked in net5.0. |
@rytido I will test with Kerberos and will update you soon. |
something to mention here about a breaking change on net 6 and kerberos . Port has been removed from SPN for Kerberos and Negotiate. I made a C# application with net 6 and kerberos and got the same results as yours. F# acted the same. When I used user name and password everything worked fine. |
That's not the issue for two reasons:
|
I am having the same issue. After running a test, I used dmesg to show where the segmentation fault happened: |
@roji have you seen similar issue with net 6 and Kerberos? I have tested with Thank you. |
May also be worth noting that in an AspNetCore app this doesn't just make a single request fail, it silently kills the whole service. |
I think this is dup of dotnet/runtime#60906. The linked breaking change only impact HttpClient in cases it tries to generate SPN on it's own. |
BTW it may be best (fastest) to update SqlClient to react to dotnet/runtime#55037. |
thanks @wfurt. Although the issue seems external according to the link you posted. I'll do more debugging to see why no exception is thrown |
for runtime, we call |
@wfurt thanks for the update. I added the |
yes, this was done late (unfortunately) in 6.0. So either wrap it In try/catch or even better if (Environment.Version.Major >= 6)
{
EnsureGssInitialized();
} Long run, I would like to add enough public surface so SqlClient (and others) do not need to depend on private functions. |
Unfortunately we are releasing GA version 4.0 today (more than half of the process is done) and most of the documents are prepared without this fix included, but we can arrange a hotfix release for near future. It needs our PM, @David-Engel , approval. |
ok. That would still probably be much faster than runtime. |
If someone didn't think of this, I cloned the repo and added
to src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.NetSecurityNative.cs and packaged homemade nuget and put it in our local repository to use until official fix is available. |
As noted above, we just missed 6.0.1, and with the holiday period, 6.0.2 is not expected to ship until the 2nd week of Feb. |
We are planning on a hotfix from our side sometime soon. Time will be announced soon. |
@rytido, @thestonehead can you try with this build and let me know if that works for you. |
We face the same issue when using the container image "ubi8/dotnet-60" from Red Hat and trying to connect to a MSSQL database using Kerberos with the code shown below. Using "ubi8/dotnet-50" everthing works as expected.
|
@aletsche the issue exists on |
@JRahnama unfortunately I don't have any possibility to test with MDS personally. Will ask a colleague tomorrow .. he might have the necessary environment to test |
BTW, this would be for 6.0.4 to release in April. Meantime perhaps someone would like to explicitly paste in the code necessary to workaround, that was mentioned above, for the ease of others. |
@danmoseley we are working on a PR to back port the fix to SDS. |
I am reopening this issue to keep a track on all other interconnected issues. |
I have run into the same issue. I have tested the suggested nuget package: However, using EntityFramework (the non-core version) version 6.4.4, I still face the issue. The workaround by @clbiggs seems to work there. Should there be a bugfix in |
@ladeak as an alternative you can use this package with MDS 4 https://www.nuget.org/packages/ErikEJ.EntityFramework.SqlServer/ |
Hi Just wondering if this issue is fixed? I'm still experiencing the same issue with latest Microsoft.Data.SqlClient 4.1.0, also tried with System.Data.SqlClient 4.8.3 |
I've been struggling trying to upgrade our .NET 5 API to .NET 6 with for days! We host our API on a Linux containers in Kubernetes. The container kept crashing and I saw that it threw a |
@duyn9uyen the problem was addressed in v4.1. |
I'm having the same issue with a .NET Core app on Xubuntu - as soon as a connection is attempted the app throws a segmentation fault (connection string Project is using Microsoft.EntityFrameworkCore.SqlServer version 6.0.7, run using .NET Core version 6.0.302 I've run |
@Palsternakka Microsoft.EntityFrameworkCore.SqlServe is using M.D.SqlClient v2.1.4. Can you overwrite the version in the csproj file by adding packageReference to version 4.1? The issue was addressed first in v4.0.1 and is not back ported to previous versions yet. <ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.1.0" />
</ItemGroup> |
After lot of debugging , below code fix works for me in .net 6.0 framework. Environment - openshift red hat OS and slq server authentication in Kerberos mode .csproj change Program.cs change
Startup.cs change
|
This worked for me, thank you! |
I did try this as I had seen this fix in one github .net 6.0 know issues and this was the one of the first thing that I tried and unfortunately this didn’t work for me and not only 4.1.0 ,I have tried next and its previous as well from nuget official website. |
Just wanna mention
This worked for us, running the dotnet6.0 runtime RHEL images. It is unfortunate this is not fixed though, any word on this from the devs? |
@IOnlyFetchBranches the fix has been back ported to 2.1 version. You can overwrite the version in the csproj to 2.1.5 and probably that will fix the problem for you. You can see the release notes here. |
All - FYI the fix introduced by this PR has been published to the System.Data.SqlClient package in nuget: https://www.nuget.org/packages/System.Data.SqlClient/4.8.4 |
Closing the issue as the fix has been ported to System.Data.SqlClient v4.8.4 latest release. |
I get error code 139 when attempting Microsoft.Data.SqlClient connection on Linux with net6.0 (6.0.100). I see the error when using
dotnet watch run
, otherwise it exits silently. The same code works on net5.0.To reproduce
app.fsproj
Program.fs
The text was updated successfully, but these errors were encountered: