Bug 47775 - non forked ant java task exits immediately on Mac OS X 10.6
Summary: non forked ant java task exits immediately on Mac OS X 10.6
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: unspecified
Hardware: Macintosh other
: P2 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-01 07:53 UTC by John McKisson
Modified: 2009-10-01 13:52 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John McKisson 2009-09-01 07:53:32 UTC
My OS is Mac OS X 10.6.  This problem exists in ant 1.7.0 (included with 10.6), 1.7.1, and the latest version I got from svn (Apache Ant version 1.8.0alpha compiled on September 1 2009).

This problem persists with both the 32 and 64 bit JVM included by Apple in 10.6, Java(TM) SE Runtime Environment (build 1.6.0_15-b03-219).

I have a simple ant java task which launches a java program:

<target name="run-server" depends="compile" description="Run the CarrierServer">
    <java classname="jDaq.server.CarrierServer"/>
</target>

Running this task appears to launch properly but then immediately exits, producing this output:

mckisson:jDaq john$ ant run-server
Buildfile: /Users/john/Development/jDaq/build.xml

init:

compile:

run-server:
     [java] Sep 1, 2009 10:41:28 AM jDaq.server.CarrierServer <clinit>
     [java] 10:41:28.981 [INFO] (main) CarrierServer:: Starting Server...
     [java] 10:41:33.650 [INFO] (main) CarrierServer:: Server running on interface 0.0.0.0
     [java] 10:41:33.651 [INFO] (main) CarrierServer:: Using TCP port 1198
     [java] 10:41:33.651 [INFO] (main) CarrierServer:: Codebase server running: http://129.57.53.6:9000/
     [java] 10:41:33.651 [INFO] (main) CarrierServer:: Looking for Devices...
     [java] 10:41:33.696 [INFO] (main) CarrierServer:: <Remote> new FpgaControl QUSB-0
     [java] 10:41:33.724 [INFO] (main) FpgaControl:: Creating new Daq/COG threads: QUSB-0
     [java] 10:41:33.725 [INFO] (QUSB-0 Daq) FpgaControl:: idle...
     [java] 10:41:33.727 [INFO] (QUSB-0 COG) FpgaControl:: idle...
     [java] 10:41:33.771 [INFO] (main) CarrierServer:: <Remote> new FpgaControl QUSB-1
     [java] 10:41:33.772 [INFO] (main) FpgaControl:: Creating new Daq/COG threads: QUSB-1
     [java] 10:41:33.777 [INFO] (QUSB-1 Daq) FpgaControl:: idle...
     [java] 10:41:33.778 [INFO] (QUSB-1 COG) FpgaControl:: idle...
     [java] 10:41:33.780 [INFO] (main) CarrierServer:: Server Ready, free memory = 71548.34kB

BUILD SUCCESSFUL
Total time: 6 seconds
mckisson:jDaq john$ 

Running the same task with fork defined as true works properly and the program does not exit immediately.
Comment 1 J.M. (Martijn) Kruithof 2009-10-01 13:52:54 UTC
This could be caused by the main thread exiting in the called java program. (This implies the program completely runs from other threads than main.)
ant calls System.exit when the end of the build is reached.

I'll investigate if it is safe to change the Main class not to call System.exit in case of an successful exit status.