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

AJAX Post Unending Loop causing API hammering #54

Open
duplaja opened this issue Feb 4, 2020 · 7 comments
Open

AJAX Post Unending Loop causing API hammering #54

duplaja opened this issue Feb 4, 2020 · 7 comments

Comments

@duplaja
Copy link

duplaja commented Feb 4, 2020

Last night, ajax posts to wp-admin/admin.php?page=codeable_transcactions_stats appeared to be stuck in a loop.

I checked my site access logs, and it tried calling it about 50,000 times last night, resulting in a temporary IP ban from the Codeable API.

It looks like at some point the API timed out (possibly after my IP ban from the API), but the plugin kept attempting indefinitely.

@raleighleslie
Copy link
Contributor

raleighleslie commented Feb 4, 2020

I saw General posted this in expert lobby... related?

Matjaz Muhic 5:24 AM
@here just a quick update: We've deployed a patch to our API that restricts per_page parameter to max 50 items per page. We've had bunch of incidents over last few months when people turn on some scripts or the WP expert stats plugin and it starts bashing our API causing response times to skyrocket and making usage of the App and API for other experts and client quite unpleasant.
If anyone relies on some of the endpoints returning more than that, let's create a thread and discuss it there. I know Marius relies on listing more comments to determine if client answered his own comment. But querying 999 comments per page is not the best solution. 🙂 If you give us some examples we can maybe make some quick modifications or additions where possible.
Thank you for your understanding! 🤝

@duplaja
Copy link
Author

duplaja commented Feb 4, 2020

Definitely related. It also pushed my CPU usage to 130% of the threshold on my VPS ($20 Linode droplet).

Your Linode has exceeded the notification threshold (90) for CPU Usage by averaging 130.9% for the last 2 hours.

@PanosSynetos
Copy link
Contributor

PanosSynetos commented Feb 4, 2020 via email

@duplaja
Copy link
Author

duplaja commented Feb 4, 2020

I've just used the default settings. I used it a day or two ago with no issues. The only thing I can think of is that I might have closed out the browser while it was still pulling / updating.

@PanosSynetos
Copy link
Contributor

Can you give it a try with 2 days and let me know how it behaves?

@duplaja
Copy link
Author

duplaja commented Feb 4, 2020

Everything seems to be working fine with 2 days. I ran it with 0, and it worked as well. This has been a one-off occurrence, and haven't been able to recreate. Unfortunately, with the message from Matjaz in the workroom, even a once-off occasionally from any of the users can cause huge issues.

Is there a maximum number of API endpoint retries that the plugin attempts before aborting? The only other thing I can think is that if there isn't, there were some other (non expert stats plugin related) script API issues with another expert's scripts going on at the same time, that might have caused time-outs. I'm wondering if he and I set up a sort of feedback loop, where due to things timing out, both of our scripts kept retrying and hitting the endpoints.

@PanosSynetos
Copy link
Contributor

Is there a maximum number of API endpoint retries that the plugin attempts before aborting

I don't know, maybe @stracker-phil can help us out here?

The "thing" is, that the plugin will pull data ONLY when we have the page open, so one way or another we'll see if it failed or takes too long to complete. It doesn't run in the background (unless you leave the tab open)

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

No branches or pull requests

3 participants