ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 41602] Ant jython attributes are not thread-safe
Date Mon, 09 Nov 2009 17:10:16 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=41602

--- Comment #4 from valentino miazzo <valentino@miazzo.net> 2009-11-09 09:10:14 UTC
---
This bug affects also Javascript.

ANT script:
-----------

<target name="t13">
    <parallel failonany='false'>
        <t13.sd key="one" />
        <t13.sd key="two" />
        <t13.sd key="three" />
        <t13.sd key="four" />
    </parallel>
</target>

<scriptdef name="t13.sd" language="javascript">
    <attribute name="key" />
    <![CDATA[
    var key = attributes.get("key");
    project.log("threadtest called with key: " + key);
    ]]>
</scriptdef>

Results:
--------

threadtest called with key: four
threadtest called with key: four
threadtest called with key: two
threadtest called with key: three

Comment on results:
-------------------

You can see that execution 'four' of t13.sd overwrites the key parameter of
execution 'one'.

Cause:
------

Each ScriptDef object as a single ScriptRunnerBase object. This runner is used
by any ScriptDefBase pointing to the ScriptDef.
When the same 'scripdef-ined' task is used inside a parallel task,  it creates
a race condition where beans of a ScriptDefBase overwrites the beans of another
ScriptDefBase .

Fix:
----

I'm not an expert of the ANT codebase, so I cannot suggest a proper fix.
Anyway I have a quick an dirty patch that seems to fix the problem.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message