With a bit of experiment, I found that SerializationMethodInvoker catches this exception and turns it into ObjectAccessException, so such a NPE gets handled gracefully.

The stack trace from the current version of Jenkins is as follows. The stack trace is likely bit different for 1.486, but the basic flow of the event will be the same. RunMap.retrieve catches IOException:

Mar 13, 2013 10:40:58 AM hudson.model.RunMap retrieve
WARNING: could not load /tmp/hudson2161128827066568119test/jobs/test0/builds/1
hudson.util.IOException2: Unable to read /tmp/hudson2161128827066568119test/jobs/test0/builds/2013-03-13_10-40-57/build.xml
	at hudson.XmlFile.unmarshal(XmlFile.java:170)
	at hudson.model.Run.reload(Run.java:307)
	at hudson.model.Run.<init>(Run.java:296)
	at hudson.model.AbstractBuild.<init>(AbstractBuild.java:182)
	at hudson.model.Build.<init>(Build.java:103)
	at hudson.model.FreeStyleBuild.<init>(FreeStyleBuild.java:41)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
	at hudson.model.AbstractProject.loadBuild(AbstractProject.java:1106)
	at hudson.model.AbstractProject$1.create(AbstractProject.java:306)
	at hudson.model.AbstractProject$1.create(AbstractProject.java:304)
	at hudson.model.RunMap.retrieve(RunMap.java:225)
	at hudson.model.RunMap.retrieve(RunMap.java:59)
	at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:667)
	at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:629)
	at jenkins.model.lazy.AbstractLazyLoadRunMap.search(AbstractLazyLoadRunMap.java:368)
	at jenkins.model.lazy.AbstractLazyLoadRunMap.getByNumber(AbstractLazyLoadRunMap.java:526)
	at hudson.model.AbstractProject.getBuildByNumber(AbstractProject.java:1028)
	at hudson.model.AbstractProject$getBuildByNumber.call(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
	at hudson.model.RunMapTest.testRuntimeExceptionInUnmarshalling(RunMapTest.groovy:53)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at junit.framework.TestCase.runTest(TestCase.java:176)
	at org.jvnet.hudson.test.HudsonTestCase.runTest(HudsonTestCase.java:440)
	at junit.framework.TestCase.runBare(TestCase.java:141)
	at org.jvnet.hudson.test.HudsonTestCase.runBare(HudsonTestCase.java:296)
	at junit.framework.TestResult$1.protect(TestResult.java:122)
	at junit.framework.TestResult.runProtected(TestResult.java:142)
	at junit.framework.TestResult.run(TestResult.java:125)
	at junit.framework.TestCase.run(TestCase.java:129)
	at junit.framework.TestSuite.runTest(TestSuite.java:255)
	at junit.framework.TestSuite.run(TestSuite.java:250)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: com.thoughtworks.xstream.converters.ConversionException: Could not call hudson.model.RunMapTest$BombAction.readResolve() : null : Could not call hudson.model.RunMapTest$BombAction.readResolve() : null
---- Debugging information ----
message             : Could not call hudson.model.RunMapTest$BombAction.readResolve() : null
cause-exception     : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message       : Could not call hudson.model.RunMapTest$BombAction.readResolve() : null
class               : hudson.model.RunMapTest$BombAction
required-type       : hudson.model.RunMapTest$BombAction
converter-type      : hudson.util.RobustReflectionConverter
path                : /build/actions/hudson.model.RunMapTest$BombAction
line number         : 43
class[1]            : java.util.concurrent.CopyOnWriteArrayList
converter-type[1]   : hudson.util.RobustCollectionConverter
class[2]            : hudson.model.FreeStyleBuild
version             : null
-------------------------------
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
	at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
	at hudson.util.RobustCollectionConverter.populateCollection(RobustCollectionConverter.java:85)
	at com.thoughtworks.xstream.converters.collections.CollectionConverter.unmarshal(CollectionConverter.java:61)
	at hudson.util.RobustCollectionConverter.unmarshal(RobustCollectionConverter.java:76)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
	at hudson.util.RobustReflectionConverter.unmarshalField(RobustReflectionConverter.java:333)
	at hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:275)
	at hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:222)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
	at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1061)
	at hudson.util.XStream2.unmarshal(XStream2.java:109)
	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1045)
	at hudson.XmlFile.unmarshal(XmlFile.java:166)
	... 48 more
Caused by: com.thoughtworks.xstream.converters.reflection.ObjectAccessException: Could not call hudson.model.RunMapTest$BombAction.readResolve() : null
	at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callReadResolve(SerializationMethodInvoker.java:72)
	at hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:223)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
	... 71 more
Caused by: java.lang.NullPointerException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
	at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
	at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:54)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186)
	at hudson.model.RunMapTest$BombAction.readResolve(RunMapTest.groovy:60)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callReadResolve(SerializationMethodInvoker.java:66)
	... 73 more

So I'm failing to see how this failure to load one record caused the entire job to fail to load. In fact I don't see who printed that exception — anyone catching this exception from RunMap or its caller would see all sorts of chained exceptions like the one I'm providing here, and you wouldn't see the stack trace in a nice single lineage. The only place this could have been done is from inside the envinject plugin itself.

If that's the case, there must have been other additional stack traces and error messages that followed, and we need that to be able to get to the bottom of the issue.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply via email to