Skip to content

java.lang.RuntimeException: Could not find a free permitted port on the machine. #11764

@zixiao144

Description

@zixiao144

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: java.lang.RuntimeException: Could not find a free permitted port on the machine.
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:372)
at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:222)
at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:114)
at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:836)
at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:247)
at org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:1078)
at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1156)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/javax.security.auth.Subject.doAs(Subject.java:423)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1898)
at

What you expected to happen

org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: java.lang.RuntimeException: Could not find a free permitted port on the machine.
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:372)
at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:222)
at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:114)
at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:836)
at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:247)
at org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:1078)
at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1156)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/javax.security.auth.Subject.doAs(Subject.java:423)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1898)
at

How to reproduce

flink run -p 1 -sae -py test.py
[INFO] 2022-09-04 06:51:16.030 +0000 [taskAppId=TASK-20220904-6764014070048_1-2-4] TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.flink.FlinkTask:[290] - [WorkflowInstance-2][TaskInstance-4] - task run command: sudo -u asd sh /tmp/dolphinscheduler/exec/process/6763787242400/6764014070048_1/2/4/2_4.command
[INFO] 2022-09-04 06:51:16.031 +0000 [taskAppId=TASK-20220904-6764014070048_1-2-4] TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.flink.FlinkTask:[181] - [WorkflowInstance-2][TaskInstance-4] - process start, process id is: 8251
[INFO] 2022-09-04 06:51:19.031 +0000 [taskAppId=TASK-20220904-6764014070048_1-2-4] TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.flink.FlinkTask:[63] - [WorkflowInstance-0][TaskInstance-0] - ->
------------------------------------------------------------
The program finished with the following exception:

org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: java.lang.RuntimeException: Could not find a free permitted port on the machine.
	at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:372)
	at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:222)
	at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:114)
	at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:836)
	at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:247)
	at org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:1078)
	at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1156)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAs(Subject.java:423)
	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1898)
	at org.apache.flink.runtime.security.contexts.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)
	at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1156)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Could not find a free permitted port on the machine.
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999)
	at org.apache.flink.client.python.PythonEnvUtils.startGatewayServer(PythonEnvUtils.java:408)
	at org.apache.flink.client.python.PythonDriver.main(PythonDriver.java:75)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:355)
	... 11 more
Caused by: java.lang.RuntimeException: Could not find a free permitted port on the machine.
	at org.apache.flink.util.NetUtils.getAvailablePort(NetUtils.java:177)
	at org.apache.flink.client.python.PythonEnvUtils.lambda$startGatewayServer$3(PythonEnvUtils.java:386)
	at java.base/java.lang.Thread.run(Thread.java:834)

[INFO] 2022-09-04 06:51:19.057 +0000 [taskAppId=TASK-20220904-6764014070048_1-2-4] TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.flink.FlinkTask:[205] - [WorkflowInstance-2][TaskInstance-4] - process has exited, execute path:/tmp/dolphinscheduler/exec/process/6763787242400/6764014070048_1/2/4, processId:8251 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-09-04 06:51:20.034 +0000 [taskAppId=TASK-20220904-6764014070048_1-2-4] TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.flink.FlinkTask:[57] - [WorkflowInstance-0][TaskInstance-0] - FINALIZE_SESSION

Anything else

No response

Version

3.0.0

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions