Bug 58478 - Ant EXEC tasks randomly hangs while executing set of java based application commands.
Summary: Ant EXEC tasks randomly hangs while executing set of java based application c...
Status: RESOLVED INVALID
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.9.6
Hardware: PC Linux
: P2 blocker (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-04 02:32 UTC by rahulraut
Modified: 2019-07-07 12:54 UTC (History)
2 users (show)



Attachments
Ant Script which is failing inconsistently. (6.59 KB, text/xml)
2015-10-04 02:32 UTC, rahulraut
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rahulraut 2015-10-04 02:32:07 UTC
Created attachment 33160 [details]
Ant Script which is failing inconsistently.

I am using a Ant scripts which loads a xml files located at pre-defined paths into a Java Application (WEB N-Tier Architecture) using Application based API's. the ant scripts pick the xml files using loop tasks and then fire a command to load a file. The loading using ant scripts most of the time hang in between. Sometime it loads all the files. the ratio of success is 1 in every 3 attempts. I am attaching a load file along with this case.
Comment 1 rahulraut 2015-10-04 02:34:47 UTC
The command I am using to execute the ant script is ant -f $WT_HOME/build_loader.xml -DsprintName=37 -Dwt.username=xxx -Dwt.password=xxx all
JDK version is 1.7_51
Comment 2 rahulraut 2015-10-04 03:31:51 UTC
Note that I have already tried inputstring="" in exec task.
Comment 3 rahulraut 2015-10-04 04:03:48 UTC
Some additional information which may help.
Almost all the time whenever the Ant build hangs while running (using EXEC) a command (java code) is after

(ReportLoader.java)

File dtdx20 = new File(WTProperties.getServerProperties().getProperty("wt.home") + windchillDirectorySeperator +"loadXMLFiles" + windchillDirectorySeperator+ "standardX20.dtd");
File copiedDtdx20 =  new File(tempLocation+"standardX20.dtd"); 
FileUtils.copyFile(dtdx20, copiedDtdx20);
Comment 4 rahulraut 2015-10-04 04:09:37 UTC
Correcting the last sentence in the description:

I am attaching a build* file along with this case.
Comment 5 Gintas Grigelionis 2018-06-18 21:24:08 UTC
It looks like the problem is with third party code which uses FileUtils.copyFile(), but the failure occurs after copyFile() is called? in undisclosed code?
Comment 6 Eugène Adell 2019-03-11 10:32:29 UTC
(In reply to Gintas Grigelionis from comment #5)
> It looks like the problem is with third party code which uses
> FileUtils.copyFile(), but the failure occurs after copyFile() is called? in
> undisclosed code?

Since this bug was opened ( 2015-10-04 ), the commons-IO which provides FileUtils.copyFile() had the following Release Notes that could maybe be linked to this issue. I assume that the user was using Commons IO 2.4 or earlier.

Apache Commons IO Version 2.5 (https://commons.apache.org/proper/commons-io/upgradeto2_5.html)
IO-385:  FileUtils.doCopyFile can potentially loop for ever
                             Exit loop if no data to copy

Apache Commons IO 2.6 (https://commons.apache.org/proper/commons-io/upgradeto2_6.html)
IO-502: Exceptions are suppressed incorrectly when copying files.
                    Thanks to Christian Schulte.


The user could change his application then the file copy would be done by ANT instead of the ReportLoader.java on which we have no way to debug (or at least outside of our scope).

I think this bug could be closed.
Comment 7 J.M. (Martijn) Kruithof 2019-07-07 12:54:43 UTC
Assuming Eugene is right, please reopen if problem still exists and seems to originate from ant, and not from the command called.