You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mark Hindess (JIRA)" <ji...@apache.org> on 2008/02/11 12:40:09 UTC
[jira] Created: (HARMONY-5485) [classlib][luni] Runtime.exec hangs
on out-of-file-handles
[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.
[jira] Closed: (HARMONY-5485) [classlib][luni] Runtime.exec hangs
on out-of-file-handles
Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-5485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Hindess closed HARMONY-5485.
---------------------------------
Resolution: Fixed
Fixed in r620494.
> [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.