Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8277166

Data race in jdeps VersionHelper

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 18
    • 18
    • tools
    • b26

    Backports

      Description

        There's a data race in the following code in VersionHelper:

                        if (nameToVersion.containsKey(name)) {
                            if (!version.equals(nameToVersion.get(name))) {
                                throw new MultiReleaseException(
                                        "err.multirelease.version.associated",
                                        name, nameToVersion.get(name), version
                                );
                            }
                        } else {
                            nameToVersion.put(name, version);
                        }

        2 threads might be running this code concurrently. Both threads could first run the nameToVersion.containsKey(name) check, see false as the result, and then both continue to the else block to put the result in the nameToVersion map, where 1 of the 2 threads will end up overwriting the value the other thread inserted.

        Attachments

          Issue Links

            Activity

              People

                mchung Mandy Chung
                jvernee Jorn Vernee
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: