ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hal Hildebrand \(web\)" <Hal.Hildebr...@hellblazer.com>
Subject Re: What to do if <exec>ed program hangs?
Date Tue, 02 Jul 2002 00:27:46 GMT
Well, for the parallel, just rename it to Parallel2, and use it as a
foreign task.  As to the patch to execute, the only fix is to the method
waitFor():

    protected void waitFor(Process process) {
        try {
            process.waitFor();
            setExitValue(process.exitValue());
        } catch (InterruptedException e) {
            process.destroy();
        }
    }

Cheers.

BTW, I quit using beta 3 due to OutOfMemory errors after running for
more than 30 minutes of testing.  Just FYI.

----- Original Message -----
From: "Alexey Solofnenko" <A.Solofnenko@mdl.com>

> Thank you, but replacing existing tasks is dangerous, unless the code
will
> go into ANT sources. I am already using beta 3. I will try your
sources.
>
> Sincerely,
>   Alexey Solofnenko.
>
> -----Original Message-----
> From: Hal Hildebrand (web) [mailto:Hal.Hildebrand@hellblazer.com]
> Sent: Saturday, June 29, 2002 7:39 PM
> To: Ant Users List
> Subject: Re: What to do if <exec>ed program hangs?
> Importance: High
>
>
> Attached are two patched files to Ant 1.5 beta 2.  With these fixes
you
> can do:
>
>
>     <target name="testy" >
>         <parallel>
>             <sequential>
>                 ...  Do your testing here ...
>                 <property name="short_regress_done" value="yes" />
>             </sequential>
>             <sequential>
>                 <waitfor maxwait="10}"
>                          maxwaitunit="minute"
>                          checkevery="1"
>                          checkeveryunit="minute">
>                     <isset property="test_done" />
>                 </waitfor>
>                 <fail unless="test_done" message="Test timed out!" />
>             </sequential>
>         </parallel>
>     </target>
>
> The patched Parallel task's semantics are changed.  If any one of the
> parallel threads of the task throws an exception, all the threads are
> interrupted.  This means that if you do
>
> <parallel>
>     <sequential>
>             ... start your server ...
>     </sequential>
>     <sequential>
>             ... wait for server to come up ...
>             ... do your tests ...
>             ... shutdown the server ...
>     </sequential>
> </parallel>
>
> and an exception occurs (such as a build exception) in the second
> sequential task, the parallel task will exit after interrupting the
> first thread.
>
> This is where the second patched file, Execute comes in.  The patch
here
> is to handle the InterruptedException correctly (or at least handle
it)
> by always ensuring that the process is destroyed.
>
> Thus if a build exception occurs, the first task (which spawns the
> application server process) is interrupted and the process is killed.
> Combined with the use of a timeout using the waitfor task, it's a
leash
> to yank back those pesky processes and make 'em heel.
>
> Combined with the try-finally task from the source forge ant contrib,
> you pretty much have all the elements to manage multiple processes in
> Ant.
>
> ----- Original Message -----
> From: "Alexey Solofnenko" <A.Solofnenko@mdl.com>
>
> > Hello,
> >
> >   we are performing unit testing of our RMI servers during build
> process on
> > Windows. The tests are started from ANT, but execute in a different
> > environment. Unfortunately the servers not always stop correctly and
> the
> > build hangs. What would be a good way to kill the processes, so ANT
> build
> > will continue?
> >
> > - Alexey.
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
> >
> >
> >
>
> --
> To unsubscribe, e-mail:
<mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:ant-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message