ajwang / groovypptest

Automatically exported from code.google.com/p/groovypptest
0 stars 0 forks source link

Errors when Groovy++/@Typed scripts are compiled concurrently #380

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Running the main-class with the argument :
"Starter HelloWorldTyped.groovy"
in the attached maven project, we can see that compilation errors occur when we 
try to evaluate/compile Groovy++ scripts with @Typed annotation in a 
multi-threaded environment.

The test consists in running 10 tasks evaluating the script concurrently, 
spreaded on a 2-thread pool (this can be changed, but the problem was 
reproduced nearly systematically with such a scenario).

In the script, there are 2 tests that can be commented/uncommented leading with 
two kind of MultipleCompilationErrorsException (maybe there are other kinds of 
errors) :
1 => caused by ArrayOutOfBoundException
2 => caused by "Repetitive method name/signature for method ..."

I attached the 2 exception stacktraces.

The expected result should be the same successful compilation as when we don't 
use the @Typed Groovy++ annotation, i.e. when running :
"Starter HelloWorld.groovy"

Versions used (as visible in the pom.xml) :
org.codehaus.groovy:groovy:1.8.0
org.mbte.groovypp:groovypp:0.4.230_1.8.0 (but probably earlier ones as well)
asm:asm-all:3.2
antlr:antlr:2.7.7
etc ...

NB : I don't know if it's related to my environment but my mvn command were not 
able to automatically retrieve groovypp artifacts from the defined repository 
"http://groovypp.artifactoryonline.com/groovypp/libs-releases-local". I 
installed them manually.

Original issue reported on code.google.com by guillaume.cernier@gmail.com on 23 May 2011 at 12:07

Attachments:

GoogleCodeExporter commented 8 years ago
Please try v 0.4.246

Do you have any problems with not-multithreaded compilation?

Original comment by alex.tka...@gmail.com on 23 May 2011 at 12:26

GoogleCodeExporter commented 8 years ago
With v 0.4.246, the problem is the same.

And with not-multithreaded compilation (basically with nbTasks=nbThreads=1 in 
the test), there is no problem : the script compilation/evaluation both went 
fine.

Original comment by guillaume.cernier@gmail.com on 23 May 2011 at 12:53

GoogleCodeExporter commented 8 years ago
Could you please also check if problem persist in case when only one 
compilation happen at any given time? Something like compilation is  surrounded 
with synchronized block

Original comment by alex.tka...@gmail.com on 23 May 2011 at 1:00

GoogleCodeExporter commented 8 years ago
Yes, with such a synchronized block around compilation/evaluation, it works :

------------------------------------------------------------------------
  private final static Object lock = new Object();

  static class MyRunnable implements Runnable {
    ...
    public void run() {
       ...
       try {
        synchronized (lock) {
         // compile+eval
        }
       } catch (exceptions) {
       ...
       }
    }
    ...
  }
------------------------------------------------------------------------

but the multi-thread compatibility should be the same as for Groovy scripts.

Original comment by guillaume.cernier@gmail.com on 23 May 2011 at 1:49