Uploaded image for project: 'Brooklyn'
  1. Brooklyn
  2. BROOKLYN-568

Rebind failed: NPE deserializing SshFeed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.12.0
    • 1.0.0
    • None

    Description

      With Brooklyn 1.0.0-SNAPSHOT, I tried rebinding to some persisted state from 0.12.0. However, rebind failed to deserialize an SsshFeed with the exception below:

      2017-11-25T22:03:31,781 WARN  123 o.a.b.c.m.r.RebindExceptionHandlerImpl [ooklyn-persister] problem loading memento: memento kscyylt8h9 (FEED) deserialization error; continuing: com.thoughtworks.xstream.converters.ConversionException: C
      ould not call com.google.common.collect.HashMultimap.readObject() : null
      ---- Debugging information ----
      message             : Could not call com.google.common.collect.HashMultimap.readObject()
      cause-exception     : java.lang.NullPointerException
      cause-message       : null
      class               : com.google.common.collect.HashMultimap
      required-type       : com.google.common.collect.HashMultimap
      converter-type      : com.thoughtworks.xstream.converters.reflection.SerializableConverter
      path                : /feed/config/polls/com.google.guava:com.google.common.collect.HashMultimap/com.google.guava:com.google.common.collect.HashMultimap
      line number         : 135
      class[1]            : java.util.LinkedHashMap
      converter-type[1]   : org.apache.brooklyn.util.core.xstream.StringKeyMapConverter
      class[2]            : org.apache.brooklyn.core.mgmt.rebind.dto.BasicFeedMemento
      converter-type[2]   : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
      version             : 1.0.0-20171113.0927
      -------------------------------
      com.thoughtworks.xstream.converters.ConversionException: Could not call com.google.common.collect.HashMultimap.readObject() : null
      ---- Debugging information ----
      message             : Could not call com.google.common.collect.HashMultimap.readObject()
      cause-exception     : java.lang.NullPointerException
      cause-message       : null
      class               : com.google.common.collect.HashMultimap
      required-type       : com.google.common.collect.HashMultimap
      converter-type      : com.thoughtworks.xstream.converters.reflection.SerializableConverter
      path                : /feed/config/polls/com.google.guava:com.google.common.collect.HashMultimap/com.google.guava:com.google.common.collect.HashMultimap
      line number         : 135
      class[1]            : java.util.LinkedHashMap
      converter-type[1]   : org.apache.brooklyn.util.core.xstream.StringKeyMapConverter
      class[2]            : org.apache.brooklyn.core.mgmt.rebind.dto.BasicFeedMemento
      converter-type[2]   : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
      version             : 1.0.0-20171113.0927
      -------------------------------
              at com.thoughtworks.xstream.core.util.SerializationMembers.callReadObject(SerializationMembers.java:133) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.converters.reflection.SerializableConverter.doUnmarshal(SerializableConverter.java:455) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:263) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71) [269:xstream:1.4.8]
              at org.apache.brooklyn.util.core.xstream.StringKeyMapConverter.unmarshalStringKey(StringKeyMapConverter.java:120) [123:org.apache.brooklyn.core:1.0.0.20171113_0927]
              at org.apache.brooklyn.util.core.xstream.StringKeyMapConverter.unmarshalEntry(StringKeyMapConverter.java:111) [123:org.apache.brooklyn.core:1.0.0.20171113_0927]
              at org.apache.brooklyn.util.core.xstream.MapConverter.populateMap(MapConverter.java:89) [123:org.apache.brooklyn.core:1.0.0.20171113_0927]
              at com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal(MapConverter.java:87) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:480) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:412) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:263) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72) [269:xstream:1.4.8]
             at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1206) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1190) [269:xstream:1.4.8]
              at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1061) [269:xstream:1.4.8]
              at org.apache.brooklyn.util.core.xstream.XmlSerializer.deserialize(XmlSerializer.java:167) [123:org.apache.brooklyn.core:1.0.0.20171113_0927]
              at org.apache.brooklyn.util.core.xstream.XmlSerializer.fromString(XmlSerializer.java:177) [123:org.apache.brooklyn.core:1.0.0.20171113_0927]
              at org.apache.brooklyn.core.mgmt.persist.RetryingMementoSerializer.fromString(RetryingMementoSerializer.java:71) [123:org.apache.brooklyn.core:1.0.0.20171113_0927]
              at org.apache.brooklyn.core.mgmt.persist.BrooklynMementoPersisterToObjectStore$4.visit(BrooklynMementoPersisterToObjectStore.java:482) [123:org.apache.brooklyn.core:1.0.0.20171113_0927]
              at org.apache.brooklyn.core.mgmt.persist.BrooklynMementoPersisterToObjectStore$1VisitorWrapper.run(BrooklynMementoPersisterToObjectStore.java:536) [123:org.apache.brooklyn.core:1.0.0.20171113_0927]
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
              at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
              at java.lang.Thread.run(Thread.java:748) [?:?]
      Caused by: java.lang.NullPointerException
              at org.apache.brooklyn.core.sensor.ssh.SshCommandSensor.makeCommandExecutingInDirectory(SshCommandSensor.java:160) ~[?:?]
              at org.apache.brooklyn.core.sensor.ssh.SshCommandSensor$2.get(SshCommandSensor.java:128) ~[?:?]
              at org.apache.brooklyn.core.sensor.ssh.SshCommandSensor$2.get(SshCommandSensor.java:125) ~[?:?]
              at org.apache.brooklyn.feed.CommandPollConfig.toStringPollSource(CommandPollConfig.java:170) ~[?:?]
              at org.apache.brooklyn.core.feed.FeedConfig.equalsFields(FeedConfig.java:281) ~[?:?]
              at org.apache.brooklyn.core.feed.PollConfig.equalsFields(PollConfig.java:83) ~[?:?]
              at org.apache.brooklyn.feed.CommandPollConfig.equalsFields(CommandPollConfig.java:174) ~[?:?]
              at org.apache.brooklyn.core.feed.FeedConfig.hashCode(FeedConfig.java:289) ~[?:?]
              at java.util.HashMap.hash(HashMap.java:338) ~[?:?]
              at java.util.HashMap.put(HashMap.java:611) ~[?:?]
              at java.util.HashSet.add(HashSet.java:219) ~[?:?]
              at com.google.common.collect.AbstractMapBasedMultimap$WrappedCollection.add(AbstractMapBasedMultimap.java:505) ~[?:?]
              at com.google.common.collect.Serialization.populateMultimap(Serialization.java:190) ~[?:?]
              at com.google.common.collect.HashMultimap.readObject(HashMultimap.java:137) ~[?:?]
              at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source) ~[?:?]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
              at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
              at com.thoughtworks.xstream.core.util.SerializationMembers.callReadObject(SerializationMembers.java:125) ~[?:?]
              ... 36 more
      

      The feed throwing the exception was:

      <uniqueTag>SshFeed[ssh[source /var/run/flannel/subne.../65bb2d4b-&gt;flannel.mtu]]</uniqueTag>
      

      That feed's SshCommandSensor has <val_-entity>aqo7xbff1n</val_-entity>, but that entity doesn't exist in the persisted state. In fact the feed is orphaned: it is not referenced by any entity. The entity field is therefore null.

      The actual NPE is due to a bad implementation of FeedConfig.hashCode. By calling toStringPollSource, which calls getCommandSupplier().get(). But this tries to use a reference to entity <val_-entity>aqo7xbff1n</val_-entity>, which is null.

      Note that with the default persistence configuration, the deserialization of the feed is logged but rebind will continue. The error therefore does not cause a serious problem (because the feed is orphaned anyway, we don't care).

      Attachments

        Activity

          People

            aled.sage Aled Sage
            aled.sage Aled Sage
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: