You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Hal Hildebrand (web)" <Ha...@hellblazer.com> on 2002/06/04 18:58:26 UTC

Fix for Parallel task hangs

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

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