Purushottam Sinha created FLINK-41284:
-----------------------------------------
Summary: 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
Affects Versions: 2.3.0
Reporter: Purushottam Sinha
*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.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)