chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asrab...@apache.org
Subject svn commit: r832850 - in /hadoop/chukwa/trunk: CHANGES.txt src/java/org/apache/hadoop/chukwa/datacollection/adaptor/ExecAdaptor.java src/java/org/apache/hadoop/chukwa/inputtools/plugin/ExecPlugin.java
Date Wed, 04 Nov 2009 19:31:24 GMT
Author: asrabkin
Date: Wed Nov  4 19:31:24 2009
New Revision: 832850

URL: http://svn.apache.org/viewvc?rev=832850&view=rev
Log:
CHUKWA-229. Fix file descriptor leak in ExecAdaptor

Modified:
    hadoop/chukwa/trunk/CHANGES.txt
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/ExecAdaptor.java
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/plugin/ExecPlugin.java

Modified: hadoop/chukwa/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/CHANGES.txt?rev=832850&r1=832849&r2=832850&view=diff
==============================================================================
--- hadoop/chukwa/trunk/CHANGES.txt (original)
+++ hadoop/chukwa/trunk/CHANGES.txt Wed Nov  4 19:31:24 2009
@@ -13,7 +13,8 @@
     CHUKWA-408. Add optional metadata to real-time feed. (asrabkin)
 
   BUG FIXES
-  
+
+    CHUKWA-229. Fix file descriptor leak in ExecAdaptor. (asrabkin)  
 
 Release 0.3
 

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/ExecAdaptor.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/ExecAdaptor.java?rev=832850&r1=832849&r2=832850&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/ExecAdaptor.java
(original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/ExecAdaptor.java
Wed Nov  4 19:31:24 2009
@@ -66,9 +66,10 @@
       JSONObject o = exec.execute();
       try {
 
-        if (o.getInt("status") == exec.statusKO)
+        if (o.getInt("status") == exec.statusKO) {
           deregisterAndStop(false);
-
+          return;
+        }
 
         // FIXME: downstream customers would like timestamps here.
         // Doing that efficiently probably means cutting out all the

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/plugin/ExecPlugin.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/plugin/ExecPlugin.java?rev=832850&r1=832849&r2=832850&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/plugin/ExecPlugin.java
(original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/plugin/ExecPlugin.java
Wed Nov  4 19:31:24 2009
@@ -63,8 +63,6 @@
 
       Runtime runtime = Runtime.getRuntime();
       process = runtime.exec(getCmde());
-      // ProcessBuilder builder = new ProcessBuilder(cmde);
-      // Process process = builder.start();
 
       OutputReader stdOut = new OutputReader(process, Output.stdOut);
       stdOut.start();
@@ -78,10 +76,16 @@
       result.put("stdout", stdOut.output.toString());
       result.put("stderr", stdErr.output.toString());
       result.put("status", statusOK);
+      process.getOutputStream().close();
+      process.getErrorStream().close();
     } catch (Throwable e) {
       try {
         result.put("status", statusKO);
         result.put("errorLog", e.getMessage());
+        if(e.getMessage().contains("Too many open files")) {
+          //maybe die abruptly?  Error is ir-recoverable and runtime can reboot us.
+//        System.exit(1); 
+        }
       } catch (Exception e1) {
         e1.printStackTrace();
       }



Mime
View raw message