ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 38583] New: - <cvschangelog> hangs
Date Thu, 09 Feb 2006 01:40:01 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38583>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38583

           Summary: <cvschangelog> hangs
           Product: Ant
           Version: 1.6.2
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: kk@kohsuke.org


If someone uses a line like '--------------------' in the commit message,
it confuses the CVSChangelogParser, and it eventually throws an
IllegalStateException from the processGetPreviousRevision method.

Since this parser is receiving an output of a running CVS process,
this exception is propagated up and eventually hit the StreamPumper.run method,
and caught by its exception block.

The pump thread eventually exits, but when it does so it leaves the InputStream
open. So now no one is draining the pipe.

CVS, since it doesn't know that no one is draining the pipe, continues to fill
in the pipe with more output. Eventually, the pipe fills up (at the OS level),
and OS blocks the CVS process until this pipe is drained. But like I mentioned,
no one is draining this pipe, so it blocks forever.

Ant is blocking on the completion of this CVS process, so as a whole
this causes a deadlock.


But I'm not exactly sure how to fix this. I first thought about just closing the
input when something goes wrong:


        try {
            while ((length = is.read(buf)) > 0) {
                os.write(buf, 0, length);
            }
        } catch (Exception e) {
            is.close();
        } finally {

But the java.lang.Process doesn't say much about what happens if you close
a stream when the other process is still writing it. Perhaps bits get ignored,
perhaps it's not.

Alternatively, StreamPumper can also just drain the input even if the write
operation fails.

        try {
            while ((length = is.read(buf)) > 0) {
                os.write(buf, 0, length);
            }
        } catch (Exception e) {
            // drain the pipe anyway
            while ((length = is.read(buf)) > 0)
                ;
        } finally {


In any case I hope this bug gets fixed soon.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message