Details
Description
It seems that exceptions thrown from within RangerSubprocessMain.main() isn't propagated to SubprocessServer. For example, when ranger-related flags are specified, but --keytab_file and/or --principal flags are missing, SubprocessServer::Init() still returns Status::OK(), while the following message is printed into the stderr:
Exception in thread "main" org.apache.kudu.subprocess.KuduSubprocessException: Kudu principal and Keytab file must be provided when Kerberos is enabled in Ranger at org.apache.kudu.subprocess.ranger.authorization.RangerKuduAuthorizer.init(RangerKuduAuthorizer.java:78) at org.apache.kudu.subprocess.ranger.RangerProtocolHandler.<init>(RangerProtocolHandler.java:45) at org.apache.kudu.subprocess.ranger.RangerSubprocessMain.main(RangerSubprocessMain.java:39)
Apparently, SubprocessServer::StartSubprocessThread() takes care only of starting the process, but it doesn't check whether SubprocessExecutor has successfully started RangerProtocolHandler, so it's able to process at least a single message. In the particular error scenario described above, the sub-process exited immediately with non-OK status, but that wasn't detected.
It's necessary to detect early stage errors like that, so SubprocessServer::Init() would return non-OK status in case if RangerProtocolHandler hasn't started or isn't able to process a single message right after the start.