Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed infinite loop when fetching multiple pages of consumers exist #2

Merged
merged 1 commit into from
Mar 26, 2019

Conversation

lmika
Copy link
Contributor

@lmika lmika commented Mar 26, 2019

Hi @hbagdi,

Found a bug when trying to sync APIs on a Kong instance with more than 1,000 consumers. deck seem to have got into an infinite loop when dumping the consumers, fetching the first page of 1,000 consumers over and over again. I suspect that the issue was the opt variable being shadowed within the for loops.

Please take a look at this PR which fixes this for consumers, and should also fix it for the other entities (although I have not tested them). Please let me know what you think.

Thanks for the tool. It's been very helpful to us.

Regards,

Leon

The cause seems to be the 'opt' variable being shadowed within the for loops.  When a page of consumers is returned with an offset, the first page is requested again.
Copy link
Member

@hbagdi hbagdi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that this indeed happens because of shadowing and is fixed.
I wish we had a way to write a test for this but sadly, we don't have e2e integration tests for deck yet.

I tested it manually.

Thank you @lmika for the fix!

@hbagdi hbagdi merged commit 13f92f8 into Kong:master Mar 26, 2019
rainest pushed a commit that referenced this pull request Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants