harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Hindess (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-5485) [classlib][luni] Runtime.exec hangs on out-of-file-handles
Date Mon, 11 Feb 2008 11:40:09 GMT
[classlib][luni] Runtime.exec hangs on out-of-file-handles
----------------------------------------------------------

                 Key: HARMONY-5485
                 URL: https://issues.apache.org/jira/browse/HARMONY-5485
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: Unix
            Reporter: Mark Hindess
            Assignee: Mark Hindess
            Priority: Minor


Runtime.exec (in unix/procimpl.c) creates 5 pipes - 10 file handles - with no error checking.
 If you run as simple test case such as:

import java.lang.Runtime;
import java.io.IOException;

public class FileHandleHang {

    public static void main(String[] args) throws IOException {
        Runtime.getRuntime().exec("no-such-program");
    }
}

using "strace -q -f -e pipe java FileHandleHang" and look for the pipe creates which will
be
something like:

[pid  6841] pipe([50, 51])              = 0
[pid  6841] pipe([52, 53])              = 0
[pid  6841] pipe([54, 55])              = 0
[pid  6841] pipe([56, 57])              = 0
[pid  6841] pipe([58, 59])              = 0

then limit the number of file handles with "ulimit -n 56" and re-run the test then it hangs.
 The strace output would be something like:

[pid  6853] pipe([50, 51])              = 0
[pid  6853] pipe([52, 53])              = 0
[pid  6853] pipe([54, 55])              = 0
[pid  6853] pipe(0x40167760)            = -1 EMFILE (Too many open files)
[pid  6853] pipe(0x40167770)            = -1 EMFILE (Too many open files)

There really needs to be error checking on all of these pipe calls to fix this and related
problems.

I noticed this problem because recent gcc with -Wall complains about these calls with the
following warning:

  ignoring return value of 'pipe', declared with attribute warn_unused_result


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message