JDK-8028127 : Regtest java/security/Security/SynchronizedAccess.java is incorrect
  • Type: Bug
  • Component: security-libs
  • Sub-Component: java.security
  • Affected Version: 7,8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-02-11
  • Updated: 2024-09-24
  • Resolved: 2024-07-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17 JDK 21 JDK 23 JDK 24
11.0.26-oracleFixed 17.0.14-oracleFixed 21.0.6-oracleFixed 23.0.2Fixed 24 b08Fixed
Related Reports
Relates :  
Relates :  
Description
We're creating a bunch of threads which create several local providers which are added to the security framework.  However, those providers we're adding/removing are potentially lost when the following is called in the AccessorThread at the end of the loop:

                provs = Security.getProviders();

This will start adding/removing some of the system providers, in addition to the local providers.  I don't understand this, and think this was not the intent.

Also, with the rewrite of the delayed provider selection and without an implementation of sigimpl, I don't think we'll ever be getting to the removeProvider code, it's always going to be failing the getInstance call.
In addition, this test is failing on windows-i586 with the server compiler only.  See 6915983.  Could be -sameVM issue.

windows_i586-product-c2-jdk_security1

TEST: java/security/Security/SynchronizedAccess.java
JDK under test: (C:\temp\jprt\T1\T\182757~1.SS1\TESTPR~1\WINDOW~1.0-P)
java version "1.7.0-2010-02-10-182757.ss145989.tl-pit-jtreg"
Java(TM) SE Runtime Environment (build 1.7.0-2010-02-10-182757.ss145989.tl-pit-j
treg-administrator_2010_02_10_11_28-b00)
Java HotSpot(TM) Server VM (build 17.0-b08, mixed mode)


ACTION: build -- Passed. Build successful
REASON: Named class compiled on demand
TIME:   0.468 seconds
messages:
command: build SynchronizedAccess
reason: Named class compiled on demand
elapsed time (seconds): 0.468

ACTION: compile -- Passed. Compilation successful
REASON: .class file out of date or does not exist
TIME:   0.437 seconds
messages:
command: compile C:\temp\jprt\T1\T\182757.ss145989\source\test\java\security\Sec
urity\SynchronizedAccess.java
reason: .class file out of date or does not exist
elapsed time (seconds): 0.437

ACTION: main -- Error. Error while cleaning up threads after test
REASON: Assumed action based on file name: run main SynchronizedAccess
TIME:   124.844 seconds
messages:
command: main SynchronizedAccess
reason: Assumed action based on file name: run main SynchronizedAccess
elapsed time (seconds): 124.844
STDOUT:
STDERR:

TEST RESULT: Error. Error while cleaning up threads after test

Comments
Fix request [17u] I backport this for parity with 17.0.14-oracle. No risk, only a test change. Clean backport. Test passes. SAP nightly testing passes.
24-09-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk17u-dev/pull/2909 Date: 2024-09-23 10:23:42 +0000
23-09-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk21u-dev/pull/934 Date: 2024-08-19 17:14:54 +0000
19-08-2024

Fix request [21u] I backport this for parity with 21.0.6-oracle. Low risk as it only involves a test change. Patch is clean. Modified test passes and tier 1 passes with GHA.
19-08-2024

[jdk23u-fix-request] Approval Request from Shivangi Gupta test fix,no risk
01-08-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk23u/pull/50 Date: 2024-08-01 06:56:35 +0000
01-08-2024

Changeset: 330e520c Branch: master Author: Fernando Guallini <fguallini@openjdk.org> Date: 2024-07-18 22:36:26 +0000 URL: https://git.openjdk.org/jdk/commit/330e520c1d42d3a9f3e187873dcd8ed7fd561aaf
18-07-2024

More details in the PR review.
16-07-2024

Much of this test was originally broken, or else the author included code that wasn't expected to run. Because there was no actual sigimpl, the Signature.getInstance("sigalg") would always return a NSAE, and thus the subsequent removeProvider/getProviders would not be called. After the first provider name0 was added, subsequent addProvider calls would return -1, thus not actually installing additional providers, and only 10 providers would ever be installed. It is also reassigning the provs variable with Security.getProviders(). This could add/remove some of the system providers, in addition to the local providers, which is likely not the test intent.
16-07-2024

It was challenging to figure out all the issues and updates that have occurred over the years: 4162583: original bug fixed/test written. There were a number of problems with the original test. 8028127: (this bug) This test started failing on Windows for some reason. (unknown precisely why at this point) 6915983: test was added to ProblemList.txt in 2010 # Unknown problem, could be a jtreg -samevm issue? # Error while cleaning up threads after test java/security/Security/SynchronizedAccess.java generic-all 7054981: Test was removed from ProblemList.txt in 2012 during a test bug cleanup. Approach was to snapshot/restore the providers. The safer approach could have been to use --othervm, but I'm guessing the VM startup performance was of more concern than the faster startups we have now. By simply restoring the provider list captured at the beginning of the test, this *SHOULD* reset the providers in this VM back to the original setup assuming no other failures.
16-07-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/19480 Date: 2024-05-30 14:01:20 +0000
09-07-2024

The test is not so clear to me, how does it certain that provider api implementations are synchronized properly? At the minimum, test needs to be fixed to use othervm, implement sigalg, and remove call to getProviders() as Brad suggested above.
11-03-2015

This is a bug for regression test that is located in the JDK ws (http://hg.openjdk.java.net/jdk7u/jdk7u-dev/jdk/file/tip/test/java/security/Security/SynchronizedAccess.java), so I am moving the bug to JDK project.
11-11-2013

EVALUATION In the ProblemList file, there's a comment. Could this be a -samevm issue?
18-08-2010