Ethan Li created STORM-2729: ------------------------------- Summary: Fix NPE in WorkerState runWorkerStartHooks and runWorkerShutdownHooks methods Key: STORM-2729 URL: https://issues.apache.org/jira/browse/STORM-2729 Project: Apache Storm Issue Type: Bug Components: storm-client Reporter: Ethan Li Assignee: Ethan Li Priority: Critical
This happens when I tried to run 0.10 topology on 2.x cluster. It's because in 0.10, {code:java} struct StormTopology { //ids must be unique across maps // #workers to use is in conf 1: required map<string, SpoutSpec> spouts; 2: required map<string, Bolt> bolts; 3: required map<string, StateSpoutSpec> state_spouts; #reserved 4: optional list<binary> worker_hooks; #reserved 5: optional list<string> dependency_jars; #reserved 6: optional list<string> dependency_artifacts; 7: optional string storm_version; 8: optional string jdk_version; } {code} The worker_hooks field is commented out. When [WorkerState. runWorkerStartHooks ()|https://github.com/apache/storm/blob/master/storm-client/src/jvm/org/apache/storm/daemon/worker/WorkerState.java#L586] calls get_worker_hooks(), it returns null. worker_hooks is an optional field in StormTopology struct ([storm.thrift|https://github.com/apache/storm/blob/master/storm-client/src/storm.thrift#L127]). So when we call get_worker_hooks(), we need to check with is_set_worker_hooks(). BTW, this can be a common issue for all thrift structs. We should always check is_set_xxx before we call get_xxx if xxx is an optional field. -- This message was sent by Atlassian JIRA (v6.4.14#64029)