[
https://issues.apache.org/jira/browse/FLINK-25685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17479856#comment-17479856
]
Yang Wang commented on FLINK-25685:
-----------------------------------
I believe the test will pass if you use {{file.getAbsolutePath()}} instead of
{{{}file.toURI().toString(){}}}.
The root cause might be as following.
{code:java}
filesToUpload.add(
new FileUpload(
Paths.get(artifacts.getValue().filePath),// here we will treat
file:///path/of/a.tmp as a file path, not URI.
RestConstants.CONTENT_TYPE_BINARY));{code}
Instead, we could use {{artifactFilePath.getPath()}} to replace
{{artifacts.getValue().filePath}} for creating {{{}FileUpload{}}}.
> RestClusterClient gets stuck on submitting job with local user artifact
> -----------------------------------------------------------------------
>
> Key: FLINK-25685
> URL: https://issues.apache.org/jira/browse/FLINK-25685
> Project: Flink
> Issue Type: Bug
> Components: Runtime / REST
> Affects Versions: 1.15.0, 1.14.3
> Reporter: Xuannan Su
> Priority: Major
> Labels: pull-request-available
>
> I found that a job submission gets stuck if
> StreamExecutionEnvironment#registerCachedFile is called with a local file.
> After some digging, I found that it gets stuck when the RestClusterClient
> sends the job-submission request to the JobManager.
> Below is the unit test added to the `RestClusterClientTest` to reproduce the
> problem on my local machine.
> {code:java}
> @Test
> public void testJobSubmissionWithUserArtifact() throws Exception {
> try (final TestRestServerEndpoint restServerEndpoint =
> createRestServerEndpoint(new TestJobSubmitHandler())) {
> try (RestClusterClient<?> restClusterClient =
>
> createRestClusterClient(restServerEndpoint.getServerAddress().getPort())) {
> TemporaryFolder temporaryFolder = new TemporaryFolder();
> temporaryFolder.create();
> File file = temporaryFolder.newFile();
> Files.write(file.toPath(), "hello
> world".getBytes(ConfigConstants.DEFAULT_CHARSET));
> jobGraph.addUserArtifact("file",
> new
> DistributedCache.DistributedCacheEntry(file.toURI().toString(),
> false));
> restClusterClient
> .submitJob(jobGraph)
> .get();
> }
> }
> }
> {code}
> The test can pass if the `jobGraph.addUserArtifact` is not called.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)