Jose Luis López created YARN-12030:
--------------------------------------

             Summary: ApplicationHistoryServer picks its JSON writer anew at 
each start: JettisonFeature and YarnJacksonJaxbJsonProvider are both registered
                 Key: YARN-12030
                 URL: https://issues.apache.org/jira/browse/YARN-12030
             Project: Hadoop YARN
          Issue Type: Bug
          Components: timelineserver
    Affects Versions: 3.6.0
            Reporter: Jose Luis López
            Assignee: Jose Luis López


*Problem*: the timeline server (ApplicationHistoryServer) does not answer in 
one JSON format. Each time it starts, it picks one of two JSON writers, and the 
same request then returns a differently shaped body:
* Jackson: lists as JSON arrays, an empty list as {{[]}}, fields in declared 
order;
* Jettison: a one-element list collapsed to an object, an empty list as {{""}}, 
and JAXB field names such as {{eventInfoJAXB}}.

Seen on the timeline v1 put response, entity events and domains, and the 
application history responses (apps, app attempts). Restarting one build six 
times answered once with Jackson and five times with Jettison.

*Cause*: {{ApplicationHistoryServer#configure}} registers both writers:
{code:java}
config.register(new 
JettisonFeature()).register(YarnJacksonJaxbJsonProvider.class);
{code}
The dedicated Jackson writers in 
{{org.apache.hadoop.yarn.api.records.timeline.writer}} would pin some of these 
types, but {{configure}} scans {{org.apache.hadoop.yarn.api.records.writer}}, a 
package that does not exist. Only {{TimelineEntitiesWriter}} and 
{{TimelineEntityWriter}} are registered explicitly, so {{TimelinePutResponse}}, 
{{TimelineDomain(s)}} and {{TimelineEvents}} are left to whichever generic 
writer Jersey picks. That matches the set of responses that change shape.

*Earlier releases*: on branch-3.4 {{AHSWebApp}} bound only 
{{YarnJacksonJaxbJsonProvider}}, and {{TimelineServer.md}} documents the 
Jackson shape ({{"eventinfo"}}, {{\{"domains":[...]\}}}, {{\{"app":[...]\}}}).

*Fix*: register only {{YarnJacksonJaxbJsonProvider}}, as YARN-12026 does for 
the v2 reader and collector. Tests to align:
* {{TestTimelineWebServices}} registers the same pair;
* {{TestAHSWebServices}} registers {{JettisonFeature}} with the AHS 
{{JAXBContextResolver}} and asserts {{\{"apps":\{"app":[...]\}\}}}. Neither the 
3.4 server nor the docs returned that shape (the 3.4 test used a 
{{JSONJAXBContext}} the server never bound), so the assertions move to the 
documented {{\{"app":[...]\}}}, and the AHS {{JAXBContextResolver}} is then 
unused.

*How it was found*: the Jetty 12 phase A harness (HADOOP-19912) compares the 
REST responses of two builds; these responses changed shape between runs of the 
same build, on either side.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to