Skip to content
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

issue#2537 - Fix for SQLServerConnection infinite loop #2547

Merged
merged 3 commits into from
Nov 27, 2024

Conversation

machavan
Copy link
Contributor

@machavan machavan commented Nov 25, 2024

Description:

Based on issue analysis

"Could be looping infinitely because bIsClosed could be true. bIsClosed could have been set to true earlier somewhere."

we are improving the infinite loop to close all statements present in openStatements , remove them from it explicitly and terminate.

Also, it looks like this could be happening as connections/statements are being used across threads based on the issue description.

bIsClosed and openStatements are not volatile, and as a result a thread creating statements while under a request ( started using beginRequest) may add them in openStatements list, with some other thread closing them but not removing from openStatements just due to that thread having read a stale value(null) of openStatements( and other combinations of issues of this sort). Hence, we are making bIsClosed and openStatements volatile.

Testing:

  • All unit tests passed
  • The existing test RequestBoundaryMethodsTest specifically validates this code path.

@machavan
Copy link
Contributor Author

Testing:

  • All unit tests passed
  • The existing test RequestBoundaryMethodsTest specifically validates this code path.

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.96%. Comparing base (fc0cfab) to head (815069a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #2547   +/-   ##
=========================================
  Coverage     50.96%   50.96%           
- Complexity     3912     3915    +3     
=========================================
  Files           147      147           
  Lines         33460    33462    +2     
  Branches       5608     5607    -1     
=========================================
+ Hits          17052    17055    +3     
- Misses        13999    14000    +1     
+ Partials       2409     2407    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lilgreenbird lilgreenbird linked an issue Nov 25, 2024 that may be closed by this pull request
@Jeffery-Wasty
Copy link
Contributor

@machavan You need to agree to the CLA in the following format:

@microsoft-github-policy-service agree [company="{your company}"]

Before we can merge the PR.

@machavan
Copy link
Contributor Author

@microsoft-github-policy-service agree [company="{Microsoft}"]

@machavan
Copy link
Contributor Author

@microsoft-github-policy-service agree company="Microsoft"

@machavan machavan merged commit cb990f4 into main Nov 27, 2024
19 checks passed
@Jeffery-Wasty Jeffery-Wasty added this to the 12.9.0 milestone Nov 27, 2024
@Jeffery-Wasty Jeffery-Wasty deleted the dev/machavan/issue#2537 branch November 28, 2024 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed/Merged PRs
Development

Successfully merging this pull request may close these issues.

SQLServerConnection infinite loop
5 participants