Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Conversation

@HalimKim
Copy link

@HalimKim HalimKim commented Apr 18, 2023

Description of PR

When you execute oozie java action, there is no message like below if LauncherSecurityManager throws an exceptions.

<<< Invocation of Main class completed <<<

However, if system exit code from LauncherSecurityManager is zero, it is possible to consider main() method finished successfully.

Therefore, there is no problem with printing "<<< Invocation of Main class completed <<<" message in such cases.

Oozie 4.x version prints the message in finally block but Oozie 5.x version does not(There is Transition from LauncherMapper to LauncherAM class in oozie 5.x version.)

try {
Class klass = getJobConf().getClass(CONF_OOZIE_ACTION_MAIN_CLASS, Object.class);
Method mainMethod = klass.getMethod("main", String[].class);
mainMethod.invoke(null, (Object) args);
}
catch (InvocationTargetException ex) {
// Get what actually caused the exception
Throwable cause = ex.getCause();
// If we got a JavaMainException from JavaMain, then we need to unwrap it
if (JavaMainException.class.isInstance(cause)) {
cause = cause.getCause();
}
if (LauncherMainException.class.isInstance(cause)) {
errorMessage = msgPrefix + "exit code [" +((LauncherMainException)ex.getCause()).getErrorCode()
+ "]";
errorCause = null;
}
else if (SecurityException.class.isInstance(cause)) {
if (LauncherSecurityManager.getExitInvoked()) {
System.out.println("Intercepting System.exit(" + LauncherSecurityManager.getExitCode()
+ ")");
System.err.println("Intercepting System.exit(" + LauncherSecurityManager.getExitCode()
+ ")");
// if 0 main() method finished successfully
// ignoring
errorCode = LauncherSecurityManager.getExitCode();
if (errorCode != 0) {
errorMessage = msgPrefix + "exit code [" + errorCode + "]";
errorCause = null;
}
}
}
else {
throw ex;
}
}
finally {
System.out.println();
System.out.println("<<< Invocation of Main class completed <<<");
System.out.println();
}

This issue may be negligible but can cause a problem in hue editor.

hue uses regular expression to distinguish whether oozie java action is successfull or not.
https://github.com/cloudera/hue/blob/c0443438e9a29b9fbf22566022aeef27fc4c606b/desktop/libs/notebook/src/notebook/connectors/oozie_batch.py#L54

The regular expression does not match if there is no "<<< Invocation of Main class completed <<<" message so that hue considers oozie java action is not completed even though main method of oozie java action is successful.

related issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant