You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "chenzihao (Jira)" <ji...@apache.org> on 2022/03/25 08:31:00 UTC

[jira] [Created] (FLINK-26861) Log cannot be printed completely when use System.exit(1)

chenzihao created FLINK-26861:
---------------------------------

             Summary: Log cannot be printed completely when use System.exit(1)
                 Key: FLINK-26861
                 URL: https://issues.apache.org/jira/browse/FLINK-26861
             Project: Flink
          Issue Type: Bug
          Components: Client / Job Submission, Deployment / YARN
    Affects Versions: 1.12.2
            Reporter: chenzihao


When I use Yarn-Application mode to submit Flink Job and there exist an exception expected, but I cannot get it in jobmanager log. And I only get the exit code 1 in yarn log.
!image-2022-03-25-15-46-44-935.png!
h2. Relative code
{code:java}
// YarnApplicationClusterEntryPoint#main
try {
    program = getPackagedProgram(configuration);
} catch (Exception e) {
    LOG.error("Could not create application program.", e);
    Thread.sleep(10); // add this for test
    System.exit(1);
}
{code}
h2. Log info
 * The ERROR log doesn't exist before Thread.sleep.
!image-2022-03-25-15-43-11-310.png!
 * The ERROR log exists after Thread.sleep.
!image-2022-03-25-15-43-53-992.png!

h2. Reason

System.exit() terminates the currently running Java Virtual Machine too fast to print the ERROR log.
h2. Improvement

I think we can print the ERROR log to jobmanager.err before call System.exit(1) so that we can get the exception info.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)