[jira] [Created] (GROOVY-7407) Compiliation not thread safe if Grape / Ivy is used in Groovy scripts
Jex Jexler created GROOVY-7407:
Summary: Compiliation not thread safe if Grape / Ivy is used in Groovy scripts
URL: https://issues.apache.org/jira/browse/GROOVY-7407 Project: Groovy
Issue Type: Bug
Components: Compiler, Grape
Affects Versions: 2.4.3
Environment: Essentially independent of the environment, as long as Groovy scripts use Grape; also this bug seems to be present since at least Groovy 1.7.5.
Reporter: Jex Jexler
Assignee: Paul King
If Groovy scripts that import the same libraries via Grape are compiled in separate threads, compilation may fail due to race conditions.
This does not happen if several threads use the *same* instance of GroovyClassLoader (GCL), because parseClass() uses synchronization.
But as soon as different GCLs are used in separate threads or if the compiler is used directly (CompilationUnit.compile()), the issue occurs and compilation can fail.
A Java unit test will be added shortly, which reproduces the issue, although this cannot be guaranteed with 100% certainty, because there is a race condition.
Two different stacktraces have been observed in the unit test (one with an exception in Ivy, one in Grape), which will also be listed shorty, and in a different environment once a an exception down in Ivy had been observed that seemed to be related to unzipping a JAR file, but no precise record of that exists any more.
This message was sent by Atlassian JIRA