-
Notifications
You must be signed in to change notification settings - Fork 312
Fix rare multi-packet string corruption #3505
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
Conversation
@dotnet/sqlclientdevteam can I get a CI run please |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3505 +/- ##
==========================================
- Coverage 64.78% 58.95% -5.83%
==========================================
Files 276 270 -6
Lines 62192 61865 -327
==========================================
- Hits 40289 36472 -3817
- Misses 21903 25393 +3490
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one small request
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs
Show resolved
Hide resolved
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
* add test and simplify code to fix problems * review feedback * review feedback * review feedback
Fixes #3504
The sample data provided in the original issue by @Suchiman showed me that there were multiple problems happening when reading long strings. The data in the new test would not successfully complete the first iteration without asserting and would throw an exception on the second iteration. The lengths of the values and their combinations over multiple packets are important, even the column name lengths contribute to the offsets so they have not been changed. The data itself is randomised from a production sample.
The changes add in asserts to ensure that if we are expecting to continue that we have a stored buffer to continue with. There was a case where no buffer was present at a continue point causing the tail end of a multi-packet string to be returned to the user successfully causing an incorrect data read.
The conditions in which buffers and lengths are stored in the snapshot are relaxed. This brings the code more into line with the more relaxed handling of replay to continue that was added in previous commits. Overall I'm happier with this lessening of complexity.