Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-7380

NiFi Stateless does not validate CS correctly

    XMLWordPrintableJSON

    Details

      Description

      When the flow executed with the NiFi Stateless running mode contains a Controller Service with required properties, it'll fail as it does not take into account the configuration when performing the validation of the component.

      In StatelessControllerServiceLookup, the method

      public void enableControllerServices(final VariableRegistry variableRegistry) 
      

      first validates the configured controller services and calls

      public Collection<ValidationResult> validate(...)

      This will create a StatelessProcessContext object and a StatelessValidationContext object. Then the method validate is called on the controller service and pass the validation context as argument. It will go through the properties of the controller service and will retrieve the configured value of the properties as set in the StatelessProcessContext object. The problem is that the properties map in the Stateless Process Context supposed to contain the configured values is never set. As such, any required property in a Controller Service is considered as configured with a null value if there is no default value. This will cause the component validation to fail and the flow won't be executed.

      I opened a PR with a solution that does solve this issue. However I'm not sure this issue does not affect other scenarios and a better approach could be necessary (more in line with what is done in NiFi core).

        Attachments

        1. nifi-7380-jolt-exception.txt
          2 kB
          Mark Weghorst
        2. nifi-7380-confluent-schema-registry-exception.txt
          4 kB
          Mark Weghorst
        3. nifi-7380-flow-config.json
          13 kB
          Mark Weghorst
        4. nifi-7380-exception.txt
          3 kB
          Mark Weghorst
        5. stateless.json
          0.8 kB
          Mark Weghorst

          Issue Links

            Activity

              People

              • Assignee:
                pvillard Pierre Villard
                Reporter:
                pvillard Pierre Villard
              • Votes:
                0 Vote for this issue
                Watchers:
                4 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 - 50m
                  50m