Support » Plugin: Mailchimp for WooCommerce » /wp-json/mailchimp-for-woocommerce/v1/queue/work crashing MySQL 8

  • Resolved Raul Peixoto

    (@alignak)


    I installed this on WordPress/5.1.1 running MySQL Percona 8 and PHP 7.2 with Nginx, and the problem I’m seeing is that it always returns error 499 or 502 on /wp-json/mailchimp-for-woocommerce/v1/queue/work

    I haven’t checked if it’s creating cron jobs or whatever (had to remove it) but I do see requests almost every second to itself, until the server runs out of resources and crashes MySQL.

    Why does it need to do so many requests?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi Raul,

    I have the exact same issue for a WP/Woocommerce site. The server requests itself every 1-2 seconds which causes MySQL CPU usage to peak at 100%. This started yesterday evening at 8pm – nothing has been changed in our end…

    Entry from the Apache log:

    http://www.site.dk 1.2.3.4 – – [02/May/2019:13:36:00 +0200] “GET /wp-json/mailchimp-for-woocommerce/v1/queue/work HTTP/1.1” 200 30 “https://www.site.dk/wp-json/mailchimp-for-woocommerce/v1/queue/work” “WordPress/5.1.1; https://www.site.dk

    I have tried restarting mysql and apache, has no effect. Only solution is to disable the plugin.

    Have you found a solution for this ??

    /Jesper

    @haggren downgrading to Percona 5.7 helped (no more crash, but slower)… but ultimately only solution is to disable the plugin. I didn’t dig into the code to see what’s wrong.

    Plugin Author ryanhungate

    (@ryanhungate)

    @alignak and @haggren thanks for reaching out on this one. Be glad to assist. First question would be “what is the traffic looking like on this site?” Are we dealing with a very busy store, or is it a fairly light shopping traffic to manage?

    If it’s light shopping, we do have a setting of:

    define('MAILCHIMP_DISABLE_QUEUE', true); which will process a single job at a time vs. staying alive to process more in the single request. You might want to give that a try first to see if it fixes the issue.

    Also, there was no mention of when this was happening. Was it “during the initial sync” or was it “during normal shopping traffic after the sync was completed”?

    We do have some more advanced options to get you taken care of but let’s start with these first and go from there if you don’t mind.

    @ryanhungate I have already removed the plugin.

    Explanation was given already.
    It requests itself non stop because the reply give 499 or 502 and therefore, it doesn’t mark that request as done and probably keeps accumulating more on the queue.

    Disabling the queue may or may not work, but the real issue is that there is a 499 or 502 response (it’s random) and it’s related to MySQL 8. Just spin it and test it.

    It happened for 2 weeks, until I found out, so it’s not the initial setup.

    What you probably should do, is to install the plugin on a server with MySQL 8 and see.
    Some queries with LIMIT do not work the same… for example, you cannot use negative values anymore.

    Not sure if that’s the case, but up to you to investigate.
    I don’t have it installed anymore, so cannot help you further.
    Thanks

    Plugin Author ryanhungate

    (@ryanhungate)

    @alignak ok no problem.

    Just for the record for anyone looking at this post, the queue/work method is built to be a long running task, and is expected to stay open like that while jobs are in the queue. Yes, the database must be called to check the job counts because WordPress doesn’t have a built in queue system, and we have to use something as a holding tank for the pending jobs.

    As an example, if you have 50 jobs in the queue, that process should handle as much as it can until the memory limit has been reached for that single request, or the timeout has been hit.

    In our most recent test with MySQL 8, everything was fine, but was done with the community version.

    @ryanhungate Thanks for the details on this. We’re finding that /wp-json/mailchimp-for-woocommerce/v1/queue/work is our *most* requested page, right at the top of our varnish lists. And, indeed, it beats on MySQL quite a bit. It’s not necessarily a current problem for us, but in the interest of efficiency I’d love to not have this happening hundreds of times per minute.

    With that in mind, is it possible to disable this somehow and perhaps cron a call to that on a more reasonable schedule?

    Plugin Author ryanhungate

    (@ryanhungate)

    @macobserver referencing this same thread – https://wordpress.org/support/topic/wp-json-mailchimp-for-woocommerce-v1-queue-work-crashing-mysql-8/#post-11581618

    That’s the best way to calm the queue frequency down without having to install any cron schedules and command line options.

    If you would like to run this in the command line, please just follow this guide here – https://github.com/mailchimp/mc-woocommerce/wiki/Advanced-Queue-Setup-In-CLI-mode

    Great, thanks @ryanhungate! I’m assuming I just put that in wp-config.php, right?

    Just want to make sure I’m not missing something obvious elsewhere! 😉

    Plugin Author ryanhungate

    (@ryanhungate)

    @macobserver yep! That should do the trick. If you needed any other help trying to get the CLI version going let us know. The docs should be a good starting point but I would first make an attempt to see if changing the queue to only process one at a time is good enough for you before doing that. As long as you’re not getting hundreds of orders a day I think it should be fine.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.