HelenBlack / lambdaj

Automatically exported from code.google.com/p/lambdaj
Apache License 2.0
0 stars 0 forks source link

Exception: Unable to convert the placeholder -2147483638 in a valid argument in multi-threading environment #33

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run the App.main(String[] args) in the project attached
2. If exception is not reproduced - play around with INNER_LOOP_NUMBER and 
TASK_NUMBER consts

What is the expected output? What do you see instead?
Expected output - lots of string with some statistic numbers. Instead 
application exits with multiple Exception messages:
ch.lambdaj.function.argument.ArgumentConversionException: Unable to convert the 
placeholder -2147483646 in a valid argument
    at ch.lambdaj.function.argument.ArgumentsFactory.actualArgument(ArgumentsFactory.java:78)
    at ch.lambdaj.function.convert.ArgumentConverter.<init>(ArgumentConverter.java:23)
    at ch.lambdaj.Lambda.extract(Lambda.java:930)
    at com.test.App$1.call(App.java:66)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

What version of the product are you using? On what operating system?
2.3 JDK 1.6.0_16 under Windows XP SP3

Please provide any additional information below.
System.gc() allows to reproduce the issue faster, but even without that I 
managed to reproduce the same issue

Original issue reported on code.google.com by andrei.b...@gmail.com on 8 Aug 2010 at 2:05

Attachments:

GoogleCodeExporter commented 8 years ago
Fixed in release 2.3.1

There was a race condition during the lambdaj's arguments creation process. 
More in detail an argument is shared by multiple threads in order to save 
memory space and gain in performance. What happened in your test case is that a 
thread tried to use an argument before the other thread that started the 
argument creation and binding process (the first one that called the on() 
construct on a given method of a given class) had time to complete it. In this 
case the second thread found the argument in an inconsistent situation and 
throw the Exception.

The problem has been fixed by synchronizing the argument creation process I 
mentioned.

Original comment by mario.fu...@gmail.com on 13 Aug 2010 at 8:56