osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jira] [Commented] (BROOKLYN-568) Rebind failed: NPE deserializing SshFeed


    [ https://issues.apache.org/jira/browse/BROOKLYN-568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16439302#comment-16439302 ] 

ASF GitHub Bot commented on BROOKLYN-568:
-----------------------------------------

Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/953#discussion_r181701628
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/sensor/ssh/SshCommandSensor.java ---
    @@ -126,7 +118,7 @@ public String get() {
                     // Note that entity may be null during rebind (e.g. if this SshFeed is orphaned, with no associated entity):
                     // See https://issues.apache.org/jira/browse/BROOKLYN-568.
                     // We therefore guard against null in makeCommandExecutingInDirectory.
    -                return makeCommandExecutingInDirectory(command, executionDir, entity);
    +                return makeCommandExecutingInDirectory(params.get(SENSOR_COMMAND), params.get(SENSOR_EXECUTION_DIR), entity);
    --- End diff --
    
    I think we should do the `checkNotNull(params.get(SENSOR_COMMAND), ...)` in this `Supplier` method, and then pass it into the `makeCommandExecutingInDirectory`.
    
    If this were null, then things can go very strange. For example, we might try to execute `null` when we construct the command via:
    `finalCommand = "mkdir -p '"+execDir+"' && cd '"+execDir+"' && "+finalCommand`



> Rebind failed: NPE deserializing SshFeed
> ----------------------------------------
>
>                 Key: BROOKLYN-568
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-568
>             Project: Brooklyn
>          Issue Type: Bug
>    Affects Versions: 0.12.0
>            Reporter: Aled Sage
>            Assignee: Aled Sage
>            Priority: Major
>             Fix For: 1.0.0
>
>
> 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:
> {noformat}
> 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
> {noformat}
> The feed throwing the exception was:
> {noformat}
> <uniqueTag>SshFeed[ssh[source /var/run/flannel/subne.../65bb2d4b-&gt;flannel.mtu]]</uniqueTag>
> {noformat}
> 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).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)