joseluisll opened a new pull request, #8838: URL: https://github.com/apache/hadoop/pull/8838
### Description of PR JIRA: https://issues.apache.org/jira/browse/YARN-12025 `RouterWebServiceUtil.invokeRMWebService` sent every forwarded request through a new `ClientBuilder.newClient()`. It never used the `Client` passed in, which `createJerseyClient` builds with the configured timeouts, and closed that client instead. Two consequences: - The new client has no JSON provider. A forward that keeps the caller's `Accept` header (every `Response`-typed forward; the header defaults to JSON) gets a JSON answer that the Router cannot read. `FederationInterceptorREST#getNewApplication` reads it as `NewApplication` and fails with `MessageBodyProviderNotFoundException`. The caller sees 503 "No active SubCluster available to submit the request." - `yarn.router.webapp.connect-timeout` and `yarn.router.webapp.read-timeout` (YARN-8529) did not apply to forwarded calls, and every forwarded call left a client open. Changes: - `invokeRMWebService` sends the request through the `client` it is given and no longer closes it. Callers own their clients: `AppsBlock` and `MetricsOverviewTable` already close theirs. - `createJerseyClient` registers the JSON providers that `RMWebApp#resourceConfig` uses: `IncludeRootJSONProvider` (priority 2001), `ExcludeRootJSONProvider` (2002) and `JAXBContextResolver`. Each is built with the Router's configuration, so the Router reads and writes JSON in the format the RM produces. The JIRA suggested `JettisonFeature`, as in `RouterWebApp`, but the RM serves JSON through these MOXy providers. With Jettison, the Router fails to read the RM's `NewApplication`, which is sent without a root element: "A descriptor with default root element application-id was not found in the project". - `DefaultRequestInterceptorREST#shutdown` closes its client, and `FederationInterceptorREST#shutdown` shuts down its per-subcluster interceptors. - `TestRouterWebServicesREST#testNewApplicationJSONThroughRouterClient` forwards `createNewApplication` to the real RM through `genericForward` with no `Accept` header and with `Accept: application/json`, reusing one client from `createJerseyClient`. It reads each answer as `NewApplication`, as `FederationInterceptorREST` does. ### How was this patch tested? On Ubuntu 24.04 (WSL2), OpenJDK 17, Maven 3.9.16, `hadoop-yarn-server-router`: - `mvn test -am -Dtest='TestRouterWebServicesREST,TestRouterWebServiceUtil,TestFederationInterceptorREST*,TestRouterWebServices' -Dsurefire.rerunFailingTestsCount=0 -Dmaven.test.failure.ignore=false`: 157 tests run, 0 failures, 0 errors (`TestRouterWebServicesREST` 43, `TestFederationInterceptorREST` 77, `TestFederationInterceptorRESTRetry` 21, `TestRouterWebServiceUtil` 12, `TestRouterWebServices` 4). - The new test against the original main code fails with the error from the JIRA: `MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=application/json;charset=utf-8, type=class ...NewApplication`. - Checkstyle: no violations on the changed lines. ### For code changes: - [x] Does the title of this PR start with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')? - [ ] Object storage: Have the integration tests been executed and the endpoint declared according to the connector-specific documentation? (Not applicable: no object storage changes.) - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? (Not applicable: no new dependencies.) - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, `NOTICE-binary` files? (Not applicable.) ### AI Tooling If an AI tool was used: - [x] The PR includes the phrase "Contains content generated by <tool>" where <tool> is the name of the AI tool used. - [x] My use of AI contributions follows the ASF legal policy https://www.apache.org/legal/generative-tooling.html Contains content generated by Claude Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
