hequn8128 commented on a change in pull request #9490: [hotfix][python] add System.exit() at the end of PythonGatewayServer to ensure the JVM will exit if its parent process dies. URL: https://github.com/apache/flink/pull/9490#discussion_r315650706
########## File path: flink-python/src/main/java/org/apache/flink/client/python/PythonGatewayServer.java ########## @@ -70,11 +70,16 @@ public static void main(String[] args) throws IOException { System.exit(1); } - // Exit on EOF or broken pipe. This ensures that the server dies - // if its parent program dies. - while (System.in.read() != -1) { - // Do nothing + try { + // Exit on EOF or broken pipe. This ensures that the server dies + // if its parent program dies. + while (System.in.read() != -1) { + // Do nothing + } + gatewayServer.shutdown(); + System.exit(0); + } catch (IOException e) { + System.exit(1); Review comment: Maybe we should add this exit in the finally block and also print the error message of the error. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services