libgcj/11: Process inputstream/errorstream can block

bryce@albatross.co.nz bryce@albatross.co.nz
Mon Jul 12 18:10:00 GMT 1999


>Number:         11
>Category:       libgcj
>Synopsis:       Process inputstream/errorstream can block
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    tromey
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 12 18:10:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Bryce McKinlay
>Release:        99-07-12 libgcj snapshot
>Organization:
>Environment:
Linux 2.2, glibc 2.1, x86
>Description:
The streams returned by Process.getInputStream() and 
Process.getErrorStream() can block, causing a process to 
never exit (and hence, Process.waitFor() to never return)
if its stdout/stderr streams are not consumed. Although it
is not explicitly stated in the spec, the JDK appears to 
internally buffer output from child processes.
>How-To-Repeat:
Process p = Runtime.exec("something that produces a lot of output");
p.waitFor();
>Fix:
Implement a package-private, threaded ProcessInputStream 
class that automatically reads process output into a 
variable-sized buffer.
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Java-prs mailing list