nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Moser (JIRA)" <>
Subject [jira] [Commented] (NIFI-241) Framework FingerprintFactory begins processor life cycle but does not finish
Date Mon, 12 Jan 2015 22:58:34 GMT


Michael Moser commented on NIFI-241:

My use case is a bit of a hack.  I want to extend a processor that has a property with a FILE_EXISTS_VALIDATOR.
 But the reason I extended this processor was to auto generate that file based on other properties
that my new processor exposes.  In my processor's @OnAdded method I create this file, so that
the super processor accepts the file as valid.  I make the content of that file correct in
an @OnScheduled method.  And I delete the file in a @OnRemoved and @OnShutdown method.

I could see someone creating a JDBC connection pool in an @OnAdded method and wanting to make
sure it gets cleaned up in @OnRemoved and @OnShutdown.  Why does @OnAdded and @OnRemoved exist
if we should not use them?

I helped a developer recently that was using old code that could only take configuration using
a Spring bean.  Definitely weird in that they couldn't take advantage of processor properties
for configuration, but they used @OnAdded.

> Framework FingerprintFactory begins processor life cycle but does not finish
> ----------------------------------------------------------------------------
>                 Key: NIFI-241
>                 URL:
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>            Reporter: Michael Moser
>            Assignee: Mark Payne
>             Fix For: 0.0.1
> The FingerprintFactory will create Processor objects and invoke their initialize() and
@OnAdded methods.  If a Processor uses system resources, these methods are where those resources
are allocated.  But, those processors are never disposed by calling their @OnRemoved or @OnShutdown
methods.  This may result in system resource leaks, depending on how processors are implemented.
> To reproduce, add a processor to the NiFi graph and restart NiFi.  Note that initialize()
and @OnAdded is called at least twice (I observed 3 times) as NiFi starts.  The getIdentifier()
is different for each invocation.  Shutdown NiFi and observe that @OnShutdown is called once.

This message was sent by Atlassian JIRA

View raw message