Apache NIFI timeout while waiting for OnScheduled
<p>Is the nifi.processor.scheduling.timeout really defaulted to infinite as described in the admin guide? When I looked at the code, it looks like it is timing out after 60 seconds. We have a processor that takes a bit to start up (load resources) and are encountering the <strong>"Timed out while waiting for OnScheduled"</strong> error. Just trying to figure out why it sometimes fails on startup and then will also continue to fail with the same error. </p>

<p>Really strange. Turning off all of the processors, bouncing the instance and starting the processor individually seems to eliminate the issue.  However, if they are all on and the instance is restarted, we encounter the error.</p>

<p>Could easily be something else, but the startup sequence seems to work. </p>

<p><a href="https://nifi.apache.org/docs/nifi-docs/html/administration-guide.html" rel="nofollow">NIFI Admin</a></p>

<p><a href="https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java" rel="nofollow">NIFI Processor Code</a></p>

<p><strong>Code Snippet From NIFI Github where I found the timeout error</strong></p>

<pre><code>    String timeoutString = NiFiProperties.getInstance().getProperty(NiFiProperties.PROCESSOR_SCHEDULING_TIMEOUT);
long onScheduleTimeout = timeoutString == null ? 60000
        : FormatUtils.getTimeDuration(timeoutString.trim(), TimeUnit.MILLISECONDS);
Future&lt;?&gt; taskFuture = callback.invokeMonitoringTask(task);
try {
    taskFuture.get(onScheduleTimeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
    LOG.warn("Thread was interrupted while waiting for processor '" + this.processor.getClass().getSimpleName()
            + "' lifecycle OnScheduled operation to finish.");
    Thread.currentThread().interrupt();
    throw new RuntimeException("Interrupted while executing one of processor's OnScheduled tasks.", e);
} catch (TimeoutException e) {
    taskFuture.cancel(true);
    LOG.warn("Timed out while waiting for OnScheduled of '"
            + this.processor.getClass().getSimpleName()
            + "' processor to finish. An attempt is made to cancel the task via Thread.interrupt(). However it does not "
            + "guarantee that the task will be canceled since the code inside current OnScheduled operation may "
            + "have been written to ignore interrupts which may result in runaway thread which could lead to more issues "
            + "eventually requiring NiFi to be restarted. This is usually a bug in the target Processor '"
            + this.processor + "' that needs to be documented, reported and eventually fixed.");
    throw new RuntimeException("Timed out while executing one of processor's OnScheduled task.", e);
} catch (ExecutionException e){
    throw new RuntimeException("Failed while executing one of processor's OnScheduled task.", e);
} finally {
    callback.postMonitor();
}
</code></pre>