[
https://issues.apache.org/jira/browse/FLINK-41284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Purushottam Sinha updated FLINK-41284:
--------------------------------------
Description:
*Problem*
Once a finished application has expired from the JobManager
({{jobstore.expiration-time}}), {{GET /applications/<id>}} returns HTTP 500
"Internal server error." instead of 404. REST clients see a server error, and
the dashboard's Application page shows a new error popup every time it
refreshes.
*Evidence*
* On Flink 2.3.0, {{/applications/<id>}} returns 500 with
{{FlinkApplicationNotFoundException}} ({{Dispatcher.java:1707}}), and the
JobManager logs {{ApplicationDetailsHandler - Unhandled exception.}} on every
poll. {{/jobs/<id>}} for the same job returns 404.
* {{ApplicationDetailsHandler.java:63-68}} returns {{requestApplication()}}
without handling the not-found case, and {{ApplicationExceptionsHandler}} (line
70) does the same. Both are unchanged on master since FLINK-38760.
* {{ApplicationCancellationHandler.java:96-100}} already returns 404 for this
exception, as {{AbstractExecutionGraphHandler.java:96-98}} does for jobs.
*Proposed fix*
* Map {{FlinkApplicationNotFoundException}} to {{NotFoundException}} in
{{ApplicationDetailsHandler}} and {{ApplicationExceptionsHandler}}, the same
way the cancellation handler does. {{ApplicationsOverviewHandler}} and
{{JobManagerApplicationConfigurationHandler}} take no application ID, so they
cannot hit this.
* Dashboard: handle that 404 on the Application page the way FLINK-33165 does
for the Job page: stop polling and show a "no longer exists" notice instead of
a popup. This part reuses the helpers added in FLINK-33165.
*Acceptance*
* Handler tests: an unknown application ID returns 404 from both the details
and exceptions endpoints.
* Dashboard specs: on a 404, the application detail page stops polling and
shows the notice.
* Repro: session cluster with {{jobstore.expiration-time: 60}}; run WordCount,
wait about 80s, then query {{/applications/<id>}}. It returns 404, and the
Application page shows the notice with no popup.
!screenshot-1.png!
was:
*Problem*
Once a finished application has expired from the JobManager
({{jobstore.expiration-time}}), {{GET /applications/<id>}} returns HTTP 500
"Internal server error." instead of 404. REST clients see a server error, and
the dashboard's Application page shows a new error popup every time it
refreshes.
*Evidence*
* On Flink 2.3.0, {{/applications/<id>}} returns 500 with
{{FlinkApplicationNotFoundException}} ({{Dispatcher.java:1707}}), and the
JobManager logs {{ApplicationDetailsHandler - Unhandled exception.}} on every
poll. {{/jobs/<id>}} for the same job returns 404.
* {{ApplicationDetailsHandler.java:63-68}} returns {{requestApplication()}}
without handling the not-found case, and {{ApplicationExceptionsHandler}} (line
70) does the same. Both are unchanged on master since FLINK-38760.
* {{ApplicationCancellationHandler.java:96-100}} already returns 404 for this
exception, as {{AbstractExecutionGraphHandler.java:96-98}} does for jobs.
*Proposed fix*
* Map {{FlinkApplicationNotFoundException}} to {{NotFoundException}} in both
handlers, the same way the cancellation handler does.
* Check {{ApplicationsOverviewHandler}} and
{{JobManagerApplicationConfigurationHandler}} for the same gap.
*Acceptance*
* Handler tests: an unknown application ID returns 404 from both the details
and exceptions endpoints.
* Repro: session cluster with {{jobstore.expiration-time: 60}}; run WordCount,
wait about 80s, then query {{/applications/<id>}}. It returns 404.
!screenshot-1.png!
> REST: Application endpoints return 500 instead of 404 for unknown or expired
> applications
> -----------------------------------------------------------------------------------------
>
> Key: FLINK-41284
> URL: https://issues.apache.org/jira/browse/FLINK-41284
> Project: Flink
> Issue Type: Bug
> Components: Runtime / REST, Runtime / Web Frontend
> Affects Versions: 2.3.0
> Reporter: Purushottam Sinha
> Priority: Major
> Labels: pull-request-available
> Attachments: screenshot-1.png
>
>
> *Problem*
> Once a finished application has expired from the JobManager
> ({{jobstore.expiration-time}}), {{GET /applications/<id>}} returns HTTP 500
> "Internal server error." instead of 404. REST clients see a server error, and
> the dashboard's Application page shows a new error popup every time it
> refreshes.
> *Evidence*
> * On Flink 2.3.0, {{/applications/<id>}} returns 500 with
> {{FlinkApplicationNotFoundException}} ({{Dispatcher.java:1707}}), and the
> JobManager logs {{ApplicationDetailsHandler - Unhandled exception.}} on every
> poll. {{/jobs/<id>}} for the same job returns 404.
> * {{ApplicationDetailsHandler.java:63-68}} returns {{requestApplication()}}
> without handling the not-found case, and {{ApplicationExceptionsHandler}}
> (line 70) does the same. Both are unchanged on master since FLINK-38760.
> * {{ApplicationCancellationHandler.java:96-100}} already returns 404 for this
> exception, as {{AbstractExecutionGraphHandler.java:96-98}} does for jobs.
> *Proposed fix*
> * Map {{FlinkApplicationNotFoundException}} to {{NotFoundException}} in
> {{ApplicationDetailsHandler}} and {{ApplicationExceptionsHandler}}, the same
> way the cancellation handler does. {{ApplicationsOverviewHandler}} and
> {{JobManagerApplicationConfigurationHandler}} take no application ID, so they
> cannot hit this.
> * Dashboard: handle that 404 on the Application page the way FLINK-33165 does
> for the Job page: stop polling and show a "no longer exists" notice instead
> of a popup. This part reuses the helpers added in FLINK-33165.
> *Acceptance*
> * Handler tests: an unknown application ID returns 404 from both the details
> and exceptions endpoints.
> * Dashboard specs: on a 404, the application detail page stops polling and
> shows the notice.
> * Repro: session cluster with {{jobstore.expiration-time: 60}}; run
> WordCount, wait about 80s, then query {{/applications/<id>}}. It returns 404,
> and the Application page shows the notice with no popup.
> !screenshot-1.png!
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)