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 Fix for Parallel task hangs
Date Tue, 04 Jun 2002 21:53:13 GMT
<resend as the original didn't seem to go through.  Sorry if this is a
repeat>

Attached is my fix for the hangs that can occur in the parallel task.

I know the doc specifically warns that Parallel can hang forever, but I
can't for the life of me understand why anyone would think this is a
valuable feature of the task that needs to be preserved.

The problem is that if one of the parallel tasks essentially runs
forever, the parallel task will just hang forever - even if an exception
occurs in one of the task threads.

For example, say we have the following:
        <parallel>
            <sequential>
                 ... Start up application server
            </sequential>

            <sequential>
                ....  Wait for app server to startup
                ....  Start up Tomcat
           </sequential>

            <sequential>
                ....  Wait for Tomcat to startup
                ....  Do some testing (which throws some exception
                                                due to programming
errors
                                                or what not)
                ....  Shut down Tomcat
                ....  Shut down application server
            </sequential>
        </parallel>

This parallel task will hang forever when the exception occurs during
the
last sequential task of the parallel construct.

In the Parallel.java, the only hope the current implementation has is if
the first thread spawned throws the error.  In the case above, the last
thread spawned throws the error and the first two just sit there waiting
to be stopped by a thread that is already dead.  This is because the
join() of the task threads will wait until the Universe freezes over.

Don't know if this is the appropriate forum to post this fix (I'm not a
member of ant-dev, so I can't post it there).  However, it would be
really nice if this fix somehow made it into the release.  I'm sure I'm
not the only one who has these kinds of hangs when testing distributed
systems...

I'm sure there's other ways to accomplish this - probably more elegant -
but this change works and now tests during our short regression no
longer hang and I have a much calmer release manager to deal with now.

Cheers.

-Hal
______
science does not remove the terror of the gods
www.hellblazer.com



Mime
View raw message