[ https://issues.apache.org/jira/browse/FLINK-8785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16527671#comment-16527671 ]
ASF GitHub Bot commented on FLINK-8785: --------------------------------------- Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/6222#discussion_r199171079 --- Diff: flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/job/JobSubmitHandlerTest.java --- @@ -87,4 +89,33 @@ public void testSuccessfulJobSubmission() throws Exception { handler.handleRequest(new HandlerRequest<>(request, EmptyMessageParameters.getInstance()), mockGateway) .get(); } + + @Test + public void testFailedJobSubmission() throws Exception { + final String errorMessage = "test"; + DispatcherGateway mockGateway = mock(DispatcherGateway.class); + when(mockGateway.submitJob(any(JobGraph.class), any(Time.class))).thenReturn(FutureUtils.completedExceptionally(new Exception(errorMessage))); + GatewayRetriever<DispatcherGateway> mockGatewayRetriever = mock(GatewayRetriever.class); + + JobSubmitHandler handler = new JobSubmitHandler( + CompletableFuture.completedFuture("http://localhost:1234"), + mockGatewayRetriever, + RpcUtils.INF_TIMEOUT, + Collections.emptyMap()); + + JobGraph job = new JobGraph("testjob"); + JobSubmitRequestBody request = new JobSubmitRequestBody(job); + + try { + handler.handleRequest(new HandlerRequest<>(request, EmptyMessageParameters.getInstance()), mockGateway) + .get(); + } catch (Exception e) { + Throwable t = ExceptionUtils.stripExecutionException(e); + if (t instanceof RestHandlerException){ + Assert.assertTrue(t.getMessage().equals("Job submission failed.")); + } else { + throw e; + } + } --- End diff -- I think we should make sure that `errorMessage` is part of the `RestHandlerException#message`. Otherwise this information won't be sent to the client in the form of the `ErrorResponseBody`. > JobSubmitHandler does not handle JobSubmissionExceptions > -------------------------------------------------------- > > Key: FLINK-8785 > URL: https://issues.apache.org/jira/browse/FLINK-8785 > Project: Flink > Issue Type: Bug > Components: Job-Submission, JobManager, REST > Affects Versions: 1.5.0, 1.6.0 > Reporter: Chesnay Schepler > Assignee: Chesnay Schepler > Priority: Blocker > Labels: flip-6, pull-request-available > > If the job submission, i.e. {{DispatcherGateway#submitJob}} fails with a > {{JobSubmissionException}} the {{JobSubmissionHandler}} returns "Internal > server error" instead of signaling the failed job submission. > This can for example occur if the transmitted execution graph is faulty, as > tested by the \{{JobSubmissionFailsITCase}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005)