You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2016/12/14 19:57:22 UTC

svn commit: r1774332 - /uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/launcher/ManagedProcess.java

Author: cwiklik
Date: Wed Dec 14 19:57:22 2016
New Revision: 1774332

URL: http://svn.apache.org/viewvc?rev=1774332&view=rev
Log:
UIMA-5215 modified to populate reasonForFailure property of the IDuccProcess with data found in stderr stream. This will provide the cause of failure in case when a process cannot start due to bad log file name for example

Modified:
    uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/launcher/ManagedProcess.java

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/launcher/ManagedProcess.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/launcher/ManagedProcess.java?rev=1774332&r1=1774331&r2=1774332&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/launcher/ManagedProcess.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/launcher/ManagedProcess.java Wed Dec 14 19:57:22 2016
@@ -428,15 +428,12 @@ public class ManagedProcess implements P
 					// the reason for failure would be provided by the OS (wrong
 					// user id, bad directory,etc)
 					String errors = stdErrReader.getDataFromStream();
-					if (errors.trim().length() > 0) {
+					if (errors != null && errors.trim().length() > 0) {
 						getDuccProcess().setReasonForStoppingProcess(
 								errors.trim());
 
 			                log("ManagedProcess.drainProcessStreams",
 					    "Process Failed - stderr stream:"+getDuccProcess().getReasonForStoppingProcess());
-
-
-
 					} 
 
 					// APs can stop for any reason. There is 
@@ -449,7 +446,7 @@ public class ManagedProcess implements P
 						// start due to misconfiguration
 						// the reason for failure would be provided by the OS (wrong
 						// user id, bad directory,etc)
-						if (errors.trim().length() > 0) {
+						if (errors != null && errors.trim().length() > 0) {
                             // JP should not be marked as CROAKED if it terminates 
 							// due to a process error, failed initialization or initialization
 							// timeout. On such errors, a JP sends an event to its agent where
@@ -457,12 +454,15 @@ public class ManagedProcess implements P
 							if ( getDuccProcess().getProcessState().equals(ProcessState.Stopping) ) {
 								// the reason was already set while handling JPs Stopping event
 								getDuccProcess().setProcessState(ProcessState.Stopped); // now the JP is dead
-							} else {
+							}
+							/*
+							else {
 								// Process terminated unexpectedly. It stopped on its own due to Ducc framework
 								// error or due to some external event not initiated by an agent
 								getDuccProcess().setReasonForStoppingProcess(
 										ReasonForStoppingProcess.Croaked.toString());
 							}
+							*/
 						} else if ( exitcode - 128 == 9 || exitcode - 128 == 15 ) {
 							// Process terminated unexpectedly. It stopped on its own due to Ducc framework
 							// error or due to some external event not initiated by an agent