[GRADLE-2486] Parallel build fails with random Ivy resolution errors Created: 19/Sep/12  Updated: 04/Jan/13  Resolved: 02/Nov/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.2
Fix Version/s: 1.3-rc-1

Type: Bug
Reporter: Szabolcs Póta Assignee: Unassigned
Resolution: Fixed Votes: 0

Attachments: Text File parallel_build_error.log    


We have a multi-project build with 30+ subprojects and we are using Ivy to resolve dependencies. The Ivy repository is located both on local and on a shared network file system for which we defined custom resolvers.

With Gradle 1.2 the single threaded build works as expected however with the --parallel option we got random Ivy resolution errors.

More specifically the errors are all java.text.ParseExceptions but the exception message and the Ivy module where it occurs is random.

Some example exceptions:

java.text.ParseException: Problem occurred while parsing ivy file: multiple points in file:////<SOME_PATH>/ivy-1.5.2.xml

java.text.ParseException: Problem occurred while parsing ivy file: For input string: ".2001122E4.2001122E4" in file:////<SOME_PATH>/ivy-2012.07.10.xml

java.text.ParseException: Problem occurred while parsing ivy file: For input string: "" in file:////<SOME_PATH>/ivy-1.1.1.xml

I've attached a full exception from one of the builds. It looks to be a concurrency issue when multiple threads are trying to resolve dependencies. Unfortunately I cannot provide a reproduction project as it requires a large number of projects and dependencies so that it occurs.

Comment by Szabolcs Póta [ 25/Sep/12 ]

We managed to find the code where concurrent access causes the above described failure during parallel build. It is the org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.DownloadedIvyModuleDescriptorParser#parseDescriptor(...) method. When this is made synchronized, our build succeeds:

package org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser;
  public class DownloadedIvyModuleDescriptorParser extends XmlModuleDescriptorParser {
    synchronized public ModuleDescriptor parseDescriptor(ParserSettings ivySettings, URL xmlURL, Resource res, boolean validate) throws ParseException, IOException {
        DefaultModuleDescriptor descriptor = (DefaultModuleDescriptor) super.parseDescriptor(ivySettings, xmlURL, res, validate);
        return descriptor;

Maybe concurrency can be handled in a more fine grained manner but at the moment it helped us use and test parallel build. We would appreciate this fix in the upcoming releases.

Comment by Peter Walker (Inactive) [ 28/Sep/12 ]

We expect this to be addressed in 1.3.

Comment by Szabolcs Póta [ 01/Oct/12 ]

Thank you. We are looking forward to the fix.

Generated at Wed Jun 30 12:23:16 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.