ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 44544] New: pseudo-deadlock in Redirector. java caused by over-aggressive use of synchronized keyword
Date Thu, 06 Mar 2008 02:05:44 GMT

           Summary: pseudo-deadlock in caused by over-
                    aggressive use of synchronized keyword
           Product: Ant
           Version: 1.7.0
          Platform: PC
        OS/Version: Windows Server 2003
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks

I found this by using the <java> task.  The symptom is that <java> task std
output can appear hung even.

both handleOutput and handleInput methods (as well as many others) are
synchronized and handleInput can block waiting for some number of bytes to be
read.  While this happens, handleOutput and other methods will block.

So if <java> appears to be hung, keep typing at the command line and hitting

I workedaround this by subclassing in a horribly hackish way as

package com.teneo.esa.ant;


 * @author bloch
public class JavaWithWorkaround extends Java {

    private InputStream _s;

     * {@inheritDoc}
    protected void setupRedirector() {

        _s = redirector.getInputStream();
     * {@inheritDoc}
    public int handleInput(byte[] buffer, int offset, int length)
        throws IOException {
        // Should work whether or not redirector.inputStream == null:
        int n = _s.available();

        if (n == 0) {
            // Throttle
            try {
            } catch (InterruptedException ie) {
                // Ignore on purpose
            return 0;

        if (length > n) {
            length = n;
        return super.handleInput(buffer, offset, length);

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

View raw message