Apache NiFi - NullPointerException setting more than one thread on custom processors
<p>I am currently working on a NiFi flow that requires the implementation of custom processors to apply transformations on csv records.</p>

<p>I've noticed this behavior during some benchmarks I am performing: if only one thread is assigned to each custom processor everything works well. Assigning more threads to the custom processors results to a <strong>failed to process session due to java.lang.NullPointerException.</strong> </p>

<p>Since the error cannot be reproduced with a single thread, I am thinking more about some issues in handling the flowfiles, or some aspect of NiFi I am not aware of.</p>

<p>Processing is performed accessing to the flowfile attributes. The flowfile content is never read, and the output flowfile is returned after adding some attributes. The following is a snippet of the relevant parts of the processor code:</p>

<pre><code>@Override
public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {

    //  Will hold all the processed attributes
    Map&lt;String, String&gt; processedAttributes = new HashMap&lt;&gt;();
    FlowFile flowfile = session.get();
    ...
    //  Adds the attributes to the flowfile
    flowfile = session.putAllAttributes(flowfile, processedAttributes);
    session.transfer(flowfile, PROCESSED);
    }
</code></pre>

<p>I am running NiFi 0.7 on a m4.4xlarge Amazon ec2 instance. Since I am seeking high performances (who doesn't) I am looking for a safe way to increase the number of threads. Any suggestion is really appreciated.</p>

<p>Thank you in advance.</p>