-
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
ReadAsync throws open SSL error for specific table on Linux on Azure #145
Comments
Could you provide more specific details so we can debug better? |
Yes, we could provide you a private access to that dataset and the repro code. How can we send you these details? |
You may send me email with necessary details. |
same problem here on preview7 |
I also see this error. The app is running on the
|
I have now tried with both It turns out that |
@rmja Do you have a repro available that you can provide here? |
I am working on it... |
@cheenamalhotra Done.... I have mailed the connection string to you. Please let me know when you are done with it, so that I can shut down the database instance. The sample will run/fail depending on the launch configurration: |
@cheenamalhotra were you able to reproduce the issue on your side? |
I have investigated this further and these are my findings: The following very simple program produces the issue: Program.cs
SQL Script seeding tableCREATE TABLE Devices (
Id int identity(1,1) primary key,
DomainId nvarchar(50) not null,
Timezone nvarchar(50) not null,
DeviceNumber nvarchar(50) not null
)
BEGIN TRANSACTION
DECLARE @i int = 0
WHILE @i < 10000
BEGIN
INSERT INTO Devices (DomainId, Timezone, DeviceNumber) VALUES ('domain', 'Europe/Copenhagen', @i)
SET @i = @i + 1
END
COMMIT TRANSACTION I have only been able to reproduce it on SQL Azure, and not on my local SQL Server Developer instance. The following two cases triggers the error:
DockerfileFROM mcr.microsoft.com/dotnet/core/runtime:3.0.0-preview8-buster-slim AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
WORKDIR /src
COPY ["ConsoleApp3/ConsoleApp3.csproj", "ConsoleApp3/"]
RUN dotnet restore "ConsoleApp3/ConsoleApp3.csproj"
COPY . .
WORKDIR "/src/ConsoleApp3"
RUN dotnet build "ConsoleApp3.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "ConsoleApp3.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ConsoleApp3.dll"]
I have been unable to debug into the SqlClient inside docker, but as I have been able to reproduce it in Windows, the following is what I see when the error occurs: This ultimately results in the following exception being thrown: Some notes are:
|
If you want to debug into the source in docker you can add the pdb to the nuget package and it'll let you trace in as long as JustMyCode isn't enabled. That's how i was looking at the bug in the linked PR. [edit] They can't be related because M.D.SqlClient doesn't have the change from that PR. But i can investigate while i've got the test project setup. |
@Wraith2 got it, here is the exception thrown from within the docker container: [edit] (this is the exact same place as in Windows when ManagedSNI is enabled) Note to myself: I disabled "Just My Code" and copied |
It's going to take some poking at the TDS data to see what's wrong with it. I'll see if i can look into it this evening. It isn't going to be the same problem but it could easily be a related issue. The managed implementation has a few rough areas which is one of the reasons i've made so many changes to it in corefx. Hopefully with the faster release cadance here we can identify and rectify them independently of corefx releases and in doing so improve non-windows reliability and performance. |
@Wraith2 year, they are for sure not related. This is a different issue. The problem here has to do with reading the length of a string when the length (2 bytes) is split across two packets: This is a dump of what I see where a row corresponds to a SQL datarow:
Clearly for this to work, the 0C has to be "saved" while reading the next packet. The code that should handle this is: The following shows However, after a single step over This is of cause causing a bad interpretation. |
It might be this dotnet/corefx#37270 it looks like the change but not the fix got applied and it's the only way i know of to corrupt that buffer, it's also string specific. If so applying the same fix should work. |
@Wraith2 you are absolutely right. I can confirm that it fixes the issue. I created #171 which applies dotnet/corefx#37270 to M.D.SqlClient. Thank you so much for helping me with this! |
Apply dotnet/corefx#37270 to M.D.SqlClient. Fixes #145.
Well I'm sorry I broke it in the first place. It's been a bad day for my quality of my work. |
@David-Engel I just want to point out the severity of this bug. Basically hitting the exception is a good thing because it is quite obvious that something is wrong. However, subtle reads of bad data can happen and is why I found the bug in the first place. Getting it to throw is a special, lucky case. I would say that 1.0.19239.1 is dangerous to use in a linux/osx invironment as incorrect reads of values across packets can and will happen without any errors shown to the user. Because of this I would strongly recommend to get the fix out in a 1.0.1 patch release asap instead of waiting on a 1.1.0. |
I'm pretty sure that conversation is being had already. |
Sorry for my impatience to get this fix out in a hurry, but I really believe that it is urgent now where ef core relies on M.D.SqlClient. It's release is imminent and it will have a dependency with this fatal issue. I really hope that a patch release will be out asap. I created dotnet/efcore#17592 to track the update of the reference if this gets a patch release before the ef core release |
Apply dotnet/corefx#37270 to M.D.SqlClient. Fixes dotnet#145.
Describe the bug
When connecting to SQL Server on Azure with Linux client we get a SQLException that has a error linked to OpenSSL. We tried both Ubuntu 18x and Ubuntu 19x and same error.
Oddly enough, this error happens on a very specific table.
Also same error with older client System.Data.SqlClient
This is on net core preview 7
Expected behavior
SQL Clients reads data correctly from source data.
Further technical details
Microsoft.Data.SqlClient version: 1.0.19189.1
SQL Server version: Azure SQL Server
Operating system: Ubuntu 18.04 docker container
Additional context
Error seems to be related to SSL version https://stackoverflow.com/questions/29627991/1408f10bssl-routinesssl3-get-recordwrong-version-number-call-on-indy
The text was updated successfully, but these errors were encountered: