[ 
https://issues.apache.org/jira/browse/FLINK-10925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16691508#comment-16691508
 ] 

ASF GitHub Bot commented on FLINK-10925:
----------------------------------------

zentol closed pull request #7139: [FLINK-10925] [python] Fix NPE in 
PythonPlanStreamer
URL: https://github.com/apache/flink/pull/7139
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/plan/PythonPlanStreamer.java
 
b/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/plan/PythonPlanStreamer.java
index d25f3d51ffe..3e6a068d8aa 100644
--- 
a/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/plan/PythonPlanStreamer.java
+++ 
b/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/plan/PythonPlanStreamer.java
@@ -126,7 +126,9 @@ public void close() {
                        process.destroy();
                } finally {
                        try {
-                               server.close();
+                               if (server != null) {
+                                       server.close();
+                               }
                        } catch (IOException e) {
                                LOG.error("Failed to close socket.", e);
                        }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> NPE in PythonPlanStreamer
> -------------------------
>
>                 Key: FLINK-10925
>                 URL: https://issues.apache.org/jira/browse/FLINK-10925
>             Project: Flink
>          Issue Type: Bug
>    Affects Versions: 1.6.2
>            Reporter: Karel Kolman
>            Assignee: Karel Kolman
>            Priority: Major
>              Labels: pull-request-available
>
> Encountered the following issue while testing Python Batch API:
> {noformat}
> root@a0810aa4b51b:/opt/flink# ./bin/pyflink.sh 
> examples/python/batch/WordCount.py  -
> Starting execution of program
> Failed to run plan: null
> The program didn't contain a Flink job. Perhaps you forgot to call execute() 
> on the execution environment.
> {noformat}
> with logs containing the following stacktrace:
> {noformat}
> 2018-11-19 09:11:51,036 ERROR org.apache.flink.python.api.PythonPlanBinder    
>               - Failed to run plan.
> java.lang.NullPointerException
>         at 
> org.apache.flink.python.api.streaming.plan.PythonPlanStreamer.close(PythonPlanStreamer.java:129)
>         at 
> org.apache.flink.python.api.PythonPlanBinder.runPlan(PythonPlanBinder.java:201)
>         at 
> org.apache.flink.python.api.PythonPlanBinder.main(PythonPlanBinder.java:98)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at 
> org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:529)
>         at 
> org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:421)
>         at 
> org.apache.flink.client.program.ClusterClient.run(ClusterClient.java:426){noformat}
> My root cause was not having Python installed on the docker image being used.
> Patching Flink with 
> {noformat}
> diff --git 
> a/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/plan/PythonPlanStreamer.java
>  
> b/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/plan/PythonPlanStreamer.java
> index d25f3d51ff..3e6a068d8a 100644
> --- 
> a/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/plan/PythonPlanStreamer.java
> +++ 
> b/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/plan/PythonPlanStreamer.java
> @@ -126,7 +126,9 @@ public class PythonPlanStreamer {
>                         process.destroy();
>                 } finally {
>                         try {
> -                               server.close();
> +                               if (server != null) {
> +                                       server.close();
> +                               }
>                         } catch (IOException e) {
>                                 LOG.error("Failed to close socket.", e);
>                         }
> {noformat}
> an attempt to run Python Batch API example will fail with
> {noformat}
> root@33837d1efa28:/opt/flink# ./bin/pyflink.sh 
> examples/python/batch/WordCount.py -
> Starting execution of program
> Failed to run plan: python does not point to a valid python binary.
> The program didn't contain a Flink job. Perhaps you forgot to call execute() 
> on the execution environment
> {noformat}
> which correctly identifes the problem i was facing - missing python (or 
> incorrect python bin path).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to