[FLINK-39730][runtime] Honor maxExceptions on ApplicationExceptionsHandler#28226
Open
jubins wants to merge 3 commits into
Open
[FLINK-39730][runtime] Honor maxExceptions on ApplicationExceptionsHandler#28226jubins wants to merge 3 commits into
jubins wants to merge 3 commits into
Conversation
…ndler ApplicationExceptionsHandler did not read the maxExceptions query parameter from the request, and ApplicationExceptionsHeaders was typed on ApplicationMessageParameters (parent) rather than ApplicationExceptionsMessageParameters, leaving the latter as orphaned scaffolding from FLINK-38977. As a result, typed Java REST clients setting maxExceptions on the application endpoint had the parameter silently discarded by the server.
Collaborator
1 task
jubins
added a commit
to jubins/flink
that referenced
this pull request
May 23, 2026
Addresses review feedback on the FLINK-39711 PR: - Revert visibility change on ApplicationExceptionsMessageParameters and remove its test. The application-side parameter is silently discarded by ApplicationExceptionsHandler today; the full server-side fix is being handled in apache#28226 (FLINK-39730), so exposing the field here would land an incomplete state where clients can set a parameter the server ignores. - Revert visibility change on JobExceptionsMessageParameters.failureLabelExceptionParameter and remove testFailureLabelFilterQueryParameterIsRendered. failureLabelFilter exposure wasn't part of the JIRA scope; it was added for parity but surfaces a pre-existing FailureLabel.toString rendering quirk that deserves its own ticket. - Change test value in testMaxExceptionsQueryParameterIsRendered from 20 to 5 so the value is distinguishable from MAX_NUMBER_EXCEPTION_TO_REPORT (the server-side default), making test intent unambiguous.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Fixes FLINK-39730 —
ApplicationExceptionsHandlerdoes not read themaxExceptionsquery parameter from the request, andApplicationExceptionsHeadersis typed onApplicationMessageParameters(the parent class) rather thanApplicationExceptionsMessageParameters, leaving the latter as orphaned scaffolding from FLINK-38977. As a result, typed Java REST clients settingmaxExceptionson the application endpoint had the parameter silently discarded by the server, and downstream clients (e.g. flink-kubernetes-operator) had no way to bound the response size for long-running applications with large exception histories.This is the follow-up to FLINK-39711 (PR #28202), which exposed the parameter to the typed client API for the job endpoint. Job-side parity already works end-to-end via
JobExceptionsHandler; this PR brings the application endpoint to the same behavior.Brief change log
ApplicationExceptionsHeadersandApplicationExceptionsHandlerto be typed onApplicationExceptionsMessageParameters(previously the parentApplicationMessageParameters), so the dedicated parameters class is finally wired into the handler.ApplicationExceptionsHandler.handleRequestnow readsUpperLimitExceptionParameterfrom the request and applies the limit when constructing the response, mirroringJobExceptionsHandler.archiveApplicationWithPathuses aMAX_NUMBER_EXCEPTION_TO_REPORT = 20default when archiving JSON (no client query available at archive time), matching the job-side archive behavior.int maxSizeargument toApplicationExceptionsInfoWithHistory.fromApplicationExceptionHistory(...)that limits the rendered history via.limit(maxSize).upperLimitExceptionParameteronApplicationExceptionsMessageParametersfromprivate finaltopublic final, so callers can resolve it via the typed REST client — mirroring the change made for the job endpoint in FLINK-39711.Verifying this change
This change is covered by updated unit tests:
ApplicationExceptionsHandlerTest— new testtestMaxExceptionsLimitsHistorySizebuilds an archived application with 5 exceptions, setsmaxExceptions=2via the typed parameters, and asserts the handler returns exactly 2 entries. Existing tests in the same class were migrated to useApplicationExceptionsMessageParametersinstead ofApplicationMessageParametersto match the handler's new generic type.JobExceptionsHandlerTestcontinues to validate the analogous server-side behavior on the job endpoint, confirming the application change brings the two endpoints into parity.REST API stability snapshot and generated reference docs were regenerated to reflect the newly-declared
maxExceptionsquery parameter on/applications/:applicationid/exceptions:flink-runtime-web/src/test/resources/rest_api_v1.snapshotdocs/static/generated/rest_v1_dispatcher.ymldocs/layouts/shortcodes/generated/rest_v1_dispatcher.htmlDoes this pull request potentially affect one of the following parts
@Public(Evolving): no — none ofApplicationExceptionsHandler,ApplicationExceptionsHeaders,ApplicationExceptionsMessageParameters, orApplicationExceptionsInfoWithHistorycarries an@Public/@PublicEvolvingannotation. The generic-type-parameter switch is technically observable to any caller constructing these classes directly, but they are runtime-internal types not part of Flink's stable user-facing API.Documentation
/applications/:applicationid/exceptionsendpoint now honors the optionalmaxExceptionsquery parameter, consistent with the job-side endpoint.rest_v1_dispatcher.yml/rest_v1_dispatcher.html) — regenerated in this PR alongside the code changes.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Opus 4.7