Data race in jdeps VersionHelper

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 18
    • Affects Version/s: 18
    • Component/s: tools
    • b26

        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.

              Assignee:
              Mandy Chung (Inactive)
              Reporter:
              Jorn Vernee
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: