Uploaded image for project: 'Apache Storm'
  1. Apache Storm
  2. STORM-2729

Fix NPE in WorkerState runWorkerStartHooks and runWorkerShutdownHooks methods

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • None
    • 2.0.0
    • storm-client
    • None

    Description

      This happens when I tried to run 0.10 topology on 2.x cluster. It's because in 0.10,

      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;
      }
      

      The worker_hooks field is commented out. When WorkerState. runWorkerStartHooks () calls get_worker_hooks(), it returns null.

      worker_hooks is an optional field in StormTopology struct (storm.thrift). 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.

      Attachments

        Issue Links

          Activity

            People

              ethanli Ethan Li
              ethanli Ethan Li
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m