Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-45892

Forbid nested references to model objects

    XMLWordPrintable

Details

    Description

      Some model objects which are written at top level to their own XML file. The most important examples are AbstractItem, Run, and User.

      Sometimes various classes defined in Jenkins which are intended to be serialized via XStream will mistakenly declare a non-transient field referring back to the model object. If the class happens to be an action, property, etc. which is contained in that same model object, this will usually be harmless, as XStream will create a reference—though it will occasionally blow up in your face when using lazy loading of builds, since there are conditions under which a fresh copy of the model object will be written, which will typically be in some inconsistent state after deserialization since no onLoad method has been called on it. If the class is contained in something else, you will definitely get duplicated data, which can be rather bad.

      Jenkins should if possible block you from accidentally storing a model object inside something else.

      Attachments

        Issue Links

          Activity

            Code changed in jenkins
            User: rmpestano
            Path:
            pom.xml
            src/main/java/com/github/jenkins/lastchanges/LastChangesBuildAction.java
            http://jenkins-ci.org/commit/last-changes-plugin/ebe11aeea5e07641f89fbb0de8ce5796a17e700a
            Log:
            refs JENKINS-45892

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: rmpestano Path: pom.xml src/main/java/com/github/jenkins/lastchanges/LastChangesBuildAction.java http://jenkins-ci.org/commit/last-changes-plugin/ebe11aeea5e07641f89fbb0de8ce5796a17e700a Log: refs JENKINS-45892

            Hi drulli, thanks for your reply. I'm still facing the same issue, any other advice?

            Here is build.xml:

            <com.github.jenkins.lastchanges.LastChangesBuildAction plugin="last-changes@2.7-SNAPSHOT">
                  <buildChanges>
                    <currentRevision>
                      <commitId>08381f99f1847c56e5e469090c6adb8600f4d66e</commitId>
                      <commitMessage>update docker container
            </commitMessage>
                      <committerName>rmpestano</committerName>
                      <committerEmail>rmpestano@gmail.com</committerEmail>
                      <commitDate>11/03/2018 00:22:05 GMT-03:00</commitDate>
                    </currentRevision>
                    <previousRevision>
                      <commitId>dd255d59a85377ea2651c4570072277cd6dd069a</commitId>
                      <commitMessage>[maven-release-plugin] prepare for next development iteration
            </commitMessage>
                      <committerName>rmpestano</committerName>
                      <committerEmail>rmpestano@gmail.com</committerEmail>
                      <commitDate>10/03/2018 23:21:04 GMT-03:00</commitDate>
                    </previousRevision>
                    <diff>diff --git a/docker/Dockerfile b/docker/Dockerfile
            index e5ce847..9fe9f66 100644
            --- a/docker/Dockerfile
            +++ b/docker/Dockerfile
            @@ -1,4 +1,4 @@
            -FROM jenkins:2.73.1
            -COPY plugins.txt /usr/share/jenkins/plugins.txt
            +FROM jenkins/jenkins:2.73.1
             ENV JAVA_OPTS=&quot;-Djenkins.install.runSetupWizard=false -Dhudson.model.DirectoryBrowserSupport.CSP=\&quot;\&quot;&quot;
            -RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt
            \ No newline at end of file
            +COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
            +RUN /usr/local/bin/install-plugins.sh &lt; /usr/share/jenkins/ref/plugins.txt
            \ No newline at end of file
            diff --git a/docker/plugins.txt b/docker/plugins.txt
            index ddd6975..4452c81 100644
            --- a/docker/plugins.txt
            +++ b/docker/plugins.txt
            @@ -47,4 +47,3 @@
             workflow-step-api:2.10
             workflow-support:2.14
             cucumber-living-documentation:2.1
            -
            </diff>
                    <commits>
                      <com.github.jenkins.lastchanges.model.CommitChanges>
                        <commitInfo reference="../../../currentRevision"/>
                        <changes>diff --git a/docker/Dockerfile b/docker/Dockerfile
            index e5ce847..9fe9f66 100644
            --- a/docker/Dockerfile
            +++ b/docker/Dockerfile
            @@ -1,4 +1,4 @@
            -FROM jenkins:2.73.1
            -COPY plugins.txt /usr/share/jenkins/plugins.txt
            +FROM jenkins/jenkins:2.73.1
             ENV JAVA_OPTS=&quot;-Djenkins.install.runSetupWizard=false -Dhudson.model.DirectoryBrowserSupport.CSP=\&quot;\&quot;&quot;
            -RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt
            \ No newline at end of file
            +COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
            +RUN /usr/local/bin/install-plugins.sh &lt; /usr/share/jenkins/ref/plugins.txt
            \ No newline at end of file
            diff --git a/docker/plugins.txt b/docker/plugins.txt
            index ddd6975..4452c81 100644
            --- a/docker/plugins.txt
            +++ b/docker/plugins.txt
            @@ -47,4 +47,3 @@
             workflow-step-api:2.10
             workflow-support:2.14
             cucumber-living-documentation:2.1
            -
            </changes>
                      </com.github.jenkins.lastchanges.model.CommitChanges>
                    </commits>
                  </buildChanges>
                  <config>
                    <format>LINE</format>
                    <matching>NONE</matching>
                    <matchWordsThreshold>0.25</matchWordsThreshold>
                    <matchingMaxComparisons>1000.0</matchingMaxComparisons>
                    <showFiles>true</showFiles>
                    <synchronisedScroll>true</synchronisedScroll>
                    <since>PREVIOUS_REVISION</since>
                    <specificRevision></specificRevision>
                  </config>
                  <projectActions>
                    <com.github.jenkins.lastchanges.LastChangesProjectAction>
                      <job class="hudson.model.FreeStyleProject" resolves-to="hudson.model.AbstractItem$Replacer">
                        <fullName>test3</fullName>
                      </job>
                    </com.github.jenkins.lastchanges.LastChangesProjectAction>
                  </projectActions>
                </com.github.jenkins.lastchanges.LastChangesBuildAction>
            
            rmpestano Rafael Pestano added a comment - Hi drulli , thanks for your reply. I'm still facing the same issue, any other advice? Here is build.xml: <com.github.jenkins.lastchanges.LastChangesBuildAction plugin="last-changes@2.7-SNAPSHOT"> <buildChanges> <currentRevision> <commitId>08381f99f1847c56e5e469090c6adb8600f4d66e</commitId> <commitMessage>update docker container </commitMessage> <committerName>rmpestano</committerName> <committerEmail>rmpestano@gmail.com</committerEmail> <commitDate>11/03/2018 00:22:05 GMT-03:00</commitDate> </currentRevision> <previousRevision> <commitId>dd255d59a85377ea2651c4570072277cd6dd069a</commitId> <commitMessage>[maven-release-plugin] prepare for next development iteration </commitMessage> <committerName>rmpestano</committerName> <committerEmail>rmpestano@gmail.com</committerEmail> <commitDate>10/03/2018 23:21:04 GMT-03:00</commitDate> </previousRevision> <diff>diff --git a/docker/Dockerfile b/docker/Dockerfile index e5ce847..9fe9f66 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM jenkins:2.73.1 -COPY plugins.txt /usr/share/jenkins/plugins.txt +FROM jenkins/jenkins:2.73.1 ENV JAVA_OPTS=&quot;-Djenkins.install.runSetupWizard=false -Dhudson.model.DirectoryBrowserSupport.CSP=\&quot;\&quot;&quot; -RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt \ No newline at end of file +COPY plugins.txt /usr/share/jenkins/ref/plugins.txt +RUN /usr/local/bin/install-plugins.sh &lt; /usr/share/jenkins/ref/plugins.txt \ No newline at end of file diff --git a/docker/plugins.txt b/docker/plugins.txt index ddd6975..4452c81 100644 --- a/docker/plugins.txt +++ b/docker/plugins.txt @@ -47,4 +47,3 @@ workflow-step-api:2.10 workflow-support:2.14 cucumber-living-documentation:2.1 - </diff> <commits> <com.github.jenkins.lastchanges.model.CommitChanges> <commitInfo reference="../../../currentRevision"/> <changes>diff --git a/docker/Dockerfile b/docker/Dockerfile index e5ce847..9fe9f66 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM jenkins:2.73.1 -COPY plugins.txt /usr/share/jenkins/plugins.txt +FROM jenkins/jenkins:2.73.1 ENV JAVA_OPTS=&quot;-Djenkins.install.runSetupWizard=false -Dhudson.model.DirectoryBrowserSupport.CSP=\&quot;\&quot;&quot; -RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt \ No newline at end of file +COPY plugins.txt /usr/share/jenkins/ref/plugins.txt +RUN /usr/local/bin/install-plugins.sh &lt; /usr/share/jenkins/ref/plugins.txt \ No newline at end of file diff --git a/docker/plugins.txt b/docker/plugins.txt index ddd6975..4452c81 100644 --- a/docker/plugins.txt +++ b/docker/plugins.txt @@ -47,4 +47,3 @@ workflow-step-api:2.10 workflow-support:2.14 cucumber-living-documentation:2.1 - </changes> </com.github.jenkins.lastchanges.model.CommitChanges> </commits> </buildChanges> <config> <format>LINE</format> <matching>NONE</matching> <matchWordsThreshold>0.25</matchWordsThreshold> <matchingMaxComparisons>1000.0</matchingMaxComparisons> <showFiles>true</showFiles> <synchronisedScroll>true</synchronisedScroll> <since>PREVIOUS_REVISION</since> <specificRevision></specificRevision> </config> <projectActions> <com.github.jenkins.lastchanges.LastChangesProjectAction> <job class="hudson.model.FreeStyleProject" resolves-to="hudson.model.AbstractItem$Replacer"> <fullName>test3</fullName> </job> </com.github.jenkins.lastchanges.LastChangesProjectAction> </projectActions> </com.github.jenkins.lastchanges.LastChangesBuildAction>
            oleg_nenashev Oleg Nenashev added a comment -

            rmpestano responded in JENKINS-49368

            oleg_nenashev Oleg Nenashev added a comment - rmpestano responded in JENKINS-49368

            Code changed in jenkins
            User: rmpestano
            Path:
            src/main/java/com/github/jenkins/lastchanges/LastChangesProjectAction.java
            http://jenkins-ci.org/commit/last-changes-plugin/0cb6083a31b207099c5400e4f4a93bee8510f3a5
            Log:
            refs JENKINS-45892

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: rmpestano Path: src/main/java/com/github/jenkins/lastchanges/LastChangesProjectAction.java http://jenkins-ci.org/commit/last-changes-plugin/0cb6083a31b207099c5400e4f4a93bee8510f3a5 Log: refs JENKINS-45892

            Code changed in jenkins
            User: Yeh Fang
            Path:
            src/main/java/hudson/plugins/sauce_ondemand/BrowserAxis.java
            src/main/java/hudson/plugins/sauce_ondemand/SauceOnDemandProjectAction.java
            http://jenkins-ci.org/commit/sauce-ondemand-plugin/970a4049c927cd22618a2d0d82ff20d13dc25043
            Log:
            fix for JENKINS-45892

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Yeh Fang Path: src/main/java/hudson/plugins/sauce_ondemand/BrowserAxis.java src/main/java/hudson/plugins/sauce_ondemand/SauceOnDemandProjectAction.java http://jenkins-ci.org/commit/sauce-ondemand-plugin/970a4049c927cd22618a2d0d82ff20d13dc25043 Log: fix for JENKINS-45892

            People

              jglick Jesse Glick
              jglick Jesse Glick
              Votes:
              0 Vote for this issue
              Watchers:
              23 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: