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

Data race in jdeps VersionHelper

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 18
    • Fix Version/s: 18
    • Component/s: tools
    • Labels:
    • Resolved In Build:
      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

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

                  Dates

                  Created:
                  Updated:
                  Resolved: