JENKINS-45892: Jenkins Logs are Polluted with Warnings about Forbidden Nested Reference

Article ID:360002449851
2 minute readKnowledge base

Issue

  • The Jenkins logs are polluted with warnings about unexpected reference like the following:

Feb 13, 2018 12:50:27 PM hudson.XmlFile replaceIfNotAtTopLevel
WARNING: JENKINS-45892: reference to <OBJECT_NAME> being saved from unexpected <XML_FILE>

Environment

  • CloudBees Jenkins Enterprise - Managed controller (CJEMM) 2.89.1+

  • CloudBees Jenkins Enterprise - Operations Center (CJEOC) 2.89.1+

  • Jenkins LTS 2.89+

Resolution

Since the release of Jenkins 2.89, nested references to model objects in their own XML files are forbidden. This is explained in JENKINS-45892. If such reference is detected when saving an object (for example a build, a job, a user, …​), a WARNING is displayed in Jenkins.

Many plugins have already been fixed to comply with this improvement (for example the Blue Ocean Plugin has a fix in 1.4), other still need to be fixed.

In any cases, this is a WARNING can be ignored. HOWEVER if many objects with nested object references are being saved constantly in a Jenkins environment, this can pollutes the Jenkins logs with WARNINGS and eventually impact the overall performances of the Jenkins controller.

Solution

The solution is to upgrade the plugin that implements object(s) producing the nested reference(s). Following are plugins that have already been fixed at the time of writing this article:

The XML_FILE can help to identify the object reference. Looking at the content of the XML file you can pinpoint the nested reference by looking for the attribute hudson.model.Run$Replacer. If not sure, file a ticket with CloudBees Support and attach the XML File.

Workaround

If the Jenkins instance is impacted (performance wise) but the plugin that produces nested references has not been fixed yet, the workaround is to change the log level so that the WARNING is not logged anymore.

To prevent Jenkins from producing this warning in the logs, refer to How to change the default or package log levels to change the level of the logger hudson.XmlFile to SEVERE.