You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Max Viazovskyi <il...@gmail.com> on 2018/04/21 23:06:40 UTC

BUG: AbstractListProcessor stops to call performListing after primary node reelection to same node

Hi all,

I've encountered the bug when AbstractListProcessor stops performing listing
of entities when after reelection the same node become Primary. I'm using
dokerized NiFi 1.6.0 (Docker Version: 18.03.0-ce) and external Zookeeper.

STEPS TO REPRODUCE:
1. Download  docker-compose.yml
<http://apache-nifi-developer-list.39713.n7.nabble.com/file/t949/docker-compose.yml>  
and  PutAndListSFTP.xml
<http://apache-nifi-developer-list.39713.n7.nabble.com/file/t949/PutAndListSFTP.xml>  
2. Run /docker-compose up -d/ in the folder where you downloaded
docker-compose.yml. This command will run 3 containers - Zookeeper, NiFi
1.6.0 in Cluster Mode with 1 node, SFTPs server
3. After NiFi is up and running (check http://localhost:8080/nifi) upload
PutAndListSFTP.xml template and place it on NiFi canvas. It has simple logic
- generate flow file each 10 seconds and put it on SFTP, in parallel
ListSFTP processor "listens" for the new files and pushes data about them to
NiFi log with LogAttribute processor
4. Update PutSFTP and ListSFTP processors with password admin (to check SFTP
container use following credentials SFTP://admin:admin@localhost:2222)
5. Run the flow
6. Check the NiFi log (/docker logs -f --tail 100 nifi/) - you should see
attributes for the uploaded files on SFTP
7. Check that generated each 10 seconds files appear on SFTP /upload folder
8. Run following command to restart Zookeeper to put NiFi in reelection
state: /docker restart zookeeper/
9. After reelection phase finished check that new files appears on SFTP, but
NO new files info appears in NiFi log

I did remote debug and see when it happens AbstractListProcessor.onTrigger
method always gets to return at  line 377
<https://github.com/apache/nifi/blob/rel/nifi-1.6.0/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java#L377> 
. 

To prevent it I suggest to update justElectedPrimaryNode to false just after
entering to the first if-body like here -
https://www.diffchecker.com/LcqetmMO

What do you think?

Thanks,
Max




--
Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/

Re: BUG: AbstractListProcessor stops to call performListing after primary node reelection to same node

Posted by Max Viazovskyi <il...@gmail.com>.
PR is ready for review https://github.com/apache/nifi/pull/2657



--
Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/

Re: BUG: AbstractListProcessor stops to call performListing after primary node reelection to same node

Posted by Max Viazovskyi <il...@gmail.com>.
Thanks Bryan. Will do it a bit later.



--
Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/

Re: BUG: AbstractListProcessor stops to call performListing after primary node reelection to same node

Posted by Bryan Bende <bb...@gmail.com>.
Max,

Thanks for reporting this. I've only glanced at the code quickly, but
I see what you are saying about the boolean never getting set to false
when it hits the context.yield().

I would recommend creating a JIRA with all of this info, and then you
could submit your proposed fix as a pull request against that JIRA.

-Bryan


On Sat, Apr 21, 2018 at 7:06 PM, Max Viazovskyi <il...@gmail.com> wrote:
> Hi all,
>
> I've encountered the bug when AbstractListProcessor stops performing listing
> of entities when after reelection the same node become Primary. I'm using
> dokerized NiFi 1.6.0 (Docker Version: 18.03.0-ce) and external Zookeeper.
>
> STEPS TO REPRODUCE:
> 1. Download  docker-compose.yml
> <http://apache-nifi-developer-list.39713.n7.nabble.com/file/t949/docker-compose.yml>
> and  PutAndListSFTP.xml
> <http://apache-nifi-developer-list.39713.n7.nabble.com/file/t949/PutAndListSFTP.xml>
> 2. Run /docker-compose up -d/ in the folder where you downloaded
> docker-compose.yml. This command will run 3 containers - Zookeeper, NiFi
> 1.6.0 in Cluster Mode with 1 node, SFTPs server
> 3. After NiFi is up and running (check http://localhost:8080/nifi) upload
> PutAndListSFTP.xml template and place it on NiFi canvas. It has simple logic
> - generate flow file each 10 seconds and put it on SFTP, in parallel
> ListSFTP processor "listens" for the new files and pushes data about them to
> NiFi log with LogAttribute processor
> 4. Update PutSFTP and ListSFTP processors with password admin (to check SFTP
> container use following credentials SFTP://admin:admin@localhost:2222)
> 5. Run the flow
> 6. Check the NiFi log (/docker logs -f --tail 100 nifi/) - you should see
> attributes for the uploaded files on SFTP
> 7. Check that generated each 10 seconds files appear on SFTP /upload folder
> 8. Run following command to restart Zookeeper to put NiFi in reelection
> state: /docker restart zookeeper/
> 9. After reelection phase finished check that new files appears on SFTP, but
> NO new files info appears in NiFi log
>
> I did remote debug and see when it happens AbstractListProcessor.onTrigger
> method always gets to return at  line 377
> <https://github.com/apache/nifi/blob/rel/nifi-1.6.0/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java#L377>
> .
>
> To prevent it I suggest to update justElectedPrimaryNode to false just after
> entering to the first if-body like here -
> https://www.diffchecker.com/LcqetmMO
>
> What do you think?
>
> Thanks,
> Max
>
>
>
>
> --
> Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/