Skip to content

Fix shared timer race #2084#2085

Merged
Jeffery-Wasty merged 9 commits intomicrosoft:mainfrom
mmimica:fix_SharedTimer_race
Mar 14, 2023
Merged

Fix shared timer race #2084#2085
Jeffery-Wasty merged 9 commits intomicrosoft:mainfrom
mmimica:fix_SharedTimer_race

Conversation

@mmimica
Copy link
Copy Markdown
Contributor

@mmimica mmimica commented Feb 28, 2023

No description provided.

ulvii and others added 8 commits December 3, 2020 12:37
Release | Merge dev to master for 9.1.1-preview release
# Conflicts:
#	CHANGELOG.md
#	README.md
#	azure-pipelines.yml
#	build.gradle
#	mssql-jdbc_auth_LICENSE
#	pom.xml
#	src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
#	src/main/java/com/microsoft/sqlserver/jdbc/SQLJdbcVersion.java
#	src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java
#	src/main/java/com/microsoft/sqlserver/jdbc/SQLServerMSAL4JUtils.java
#	src/samples/adaptive/pom.xml
#	src/samples/alwaysencrypted/pom.xml
#	src/samples/azureactivedirectoryauthentication/pom.xml
#	src/samples/connections/pom.xml
#	src/samples/constrained/pom.xml
#	src/samples/dataclassification/pom.xml
#	src/samples/datatypes/pom.xml
#	src/samples/resultsets/pom.xml
#	src/samples/sparse/pom.xml
#	src/test/java/com/microsoft/sqlserver/jdbc/TestResource.java
#	src/test/java/com/microsoft/sqlserver/jdbc/databasemetadata/DatabaseMetaDataTest.java
#	src/test/java/com/microsoft/sqlserver/jdbc/fedauth/ErrorMessageTest.java
@Jeffery-Wasty Jeffery-Wasty linked an issue Feb 28, 2023 that may be closed by this pull request
@Jeffery-Wasty Jeffery-Wasty added this to the 12.3.0 milestone Feb 28, 2023
Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SharedTimer.java
@Jeffery-Wasty
Copy link
Copy Markdown
Contributor

Jeffery-Wasty commented Mar 10, 2023

After reviewing the PR again and talking with the team, I agree with the code changes, but I'm personally having issues running the test. I think it may just be my environment and will get back to you if when I can confirm everything is working correctly.

Copy link
Copy Markdown

@jubax jubax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this actually waits for an approval and if I'm the right person to approve, but still: Looks fine 👍

I was able to reproduce the race condition (an NPE was thrown) with the test before the fix and can verify that the NPE is gone after the fix is applied.

I also wrote an extended version of the test, using a latch to make sure all threads start at the same time. But as it turned out your test works fine for reproducing the issue.

(Due to security manager issues I just made a local copy of SharedTime and used that.)

@Jeffery-Wasty
Copy link
Copy Markdown
Contributor

Hi @jubax,

Yes, we were just making sure the test was passing consistently. I was having issues on my end, but that has been resolved. Everything looks fine, we'll look at getting this merged.

@Jeffery-Wasty Jeffery-Wasty merged commit 178819d into microsoft:main Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SharedTimer race condition

7 participants