woocommerce / facebook-for-woocommerce

A first-party extension plugin built for WooCommerce. Development is managed by Ventures.
https://woocommerce.com/products/facebook/
GNU General Public License v2.0
210 stars 137 forks source link

[high CPU usage after sync products]error message: FastCGI sent in stderr: "PHP message: on construct" while reading upstream #199

Closed truchosky closed 6 years ago

truchosky commented 6 years ago

hi guys, I use version 1.7.3, after install it on my site and config the pixel my CPU goes to 100%, I use nginx + php5-fpm, checking nginx log I saw this:

2018/01/04 19:09:52 [error] 679#0: 2731 FastCGI sent in stderr: "PHP message: on construct" while reading upstream, client: 173.252.86.66, server: la-maria.cl, request: "GET /producto/marco-polo-bubbler/?attribute_pa_color=gold HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/web16.sock:", host: "la-maria.cl" 2018/01/04 19:09:56 [error] 679#0: 2733 FastCGI sent in stderr: "PHP message: on construct" while reading upstream, client: 173.252.92.179, server: la-maria.cl, request: "GET /producto/shot-glass-taster/?attribute_pa_color=blanco HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/web16.sock:", host: "la-maria.cl" 2018/01/04 19:10:03 [error] 679#0: 2737 FastCGI sent in stderr: "PHP message: on construct" while reading upstream, client: 173.252.90.233, server: la-maria.cl, request: "GET /producto/kraken-hex/?attribute_pa_color=rosado HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/web16.sock:", host: "la-maria.cl" 2018/01/04 19:10:07 [error] 679#0: 2740 FastCGI sent in stderr: "PHP message: on construct" while reading upstream, client: 173.252.84.205, server: la-maria.cl, request: "GET /producto/high-voltage/?attribute_pa_color=negro HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/web16.sock:", host: "la-maria.cl"

and a lot, lot lot more, any thoughts, ideas, is this a bug? ?

truchosky commented 6 years ago

attach error log since plugin installation (31/12/2017) error.log

jieminz22 commented 6 years ago

Hi,

To investigate this further, could you please provide more details?

Also as a temporary workaround, you can try deactivating all other extensions to see if the problem persists.

Thanks.

truchosky commented 6 years ago

Akismet Anti-Spam Contact Form 7 Easy WP SMTP WooCommerce Flow Webpay Jetpack by WordPress.com Loco Translate Nextend Facebook Connect Nextend Google Connect Regenerate Thumbnails WooCommerce Chilexpress Shipping WooCommerce Email Customizer WooCommerce Google Analytics Integration WooCommerce khipu WooCommerce khipubacs WooCommerce Shipping Tracking WooCommerce WooSidebars Yoast SEO Premium YITH WooCommerce Wishlist

mengyingdu commented 6 years ago

Hi @truchosky ,

Did you publish your page?

truchosky commented 6 years ago

do you mean in facebook?, yes, off course, i have the page since.... a lot, but page + pixel only since 31/12/2017

ps: I tried with php 5 + php5-fpm, same error with php 7 + php7-fpm

mengyingdu commented 6 years ago

Hi @truchosky ,

  1. As for your error log: I found a warning message about facebook: PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback possible reason: 1) did you use this filter: reading 2) Some theme has compatibility issue. Can you try different theme to check whether it still exists?
    If you have too many PHP error/warning logs, it may raise your CPU % problem.
  2. As for your sync issue, I looked into our remove log, it's an internal server error which usually is temporary. Can you try to sync again?

Let me know if you still have problems.

truchosky commented 6 years ago

the problem is not the sync, the sync is working correct, the problem is the cpu raise to 100% with this plugin activate, inmediatly after disable it the cpu goes normal again, I attach another log this time with php7-fpm error.log

mengyingdu commented 6 years ago

Hi @truchosky ,

Sorry to hear that your problems and I understand that you have CPU raise with the plugin activate. I looked into your error log and the errors related to facebook most are from connection timed-out. I went to your website and the pixel is not active (I think you follow the advanced option to delete your setting as a try to fix it). I have some workaround suggested to you:

  1. What's your PHP memory limit? 64MB? normally wordpress should recommend 256MB
  2. Deactivate and delete facebook-for-woocommerce, try disabling all other plugins, and then reinstall and activate facebook-for-woocommerce. Does the cpu issue persist? (From your log error, it possible installed incorrectly because of some incompatibility issue. But it keeps the GET requests, it also may cause this issue. This can help us troubleshooting.)
  3. CPU issues are unfortunately extremely difficult to debug. Since not everyone is experiencing this problem, my guess is that our plugin combined with another plugin that you have is causing the memory issue. We have see similar but may not exactly the same issue about CPU #83 #98

Can you follow my suggestion and give a try? Thanks.

truchosky commented 6 years ago

you are correct, I delete setings to fix the issue.

  1. yes, 256 MB 2 .I dont know if was the version or deactivated all plugins but pixel, Version 1.7.4 no longer with errors on log, I deactivated all plugins except for woocoommerce, cpu rises to 40%, if i deactivate plugin cpu is less than 10% used
  2. almost the same, when I sync facebook with woocommerce cpu and memory rise but only until sync finishes, then is only the CPU, the only fix is disable plugin
mengyingdu commented 6 years ago

Unfortunately I don't have any good answer why the CPU rises so high. I'm looking into performance enhance now, even though it's hard to debug since every server experience differently. I will keep this issue open and update as soon as I have fix.

Thanks for your patience and try!

dmitridr commented 6 years ago

Hey @truchosky can you try v1.8.1? We're reasonably sure that this will fix your CPU problem as we saw a huge performance increase with this fix and the way product sync works has changed entirely.

dmitridr commented 6 years ago

v1.8.2 follows up and increases the CPU perf even further and fixes some potential excess CPU caused by admin-ajax. Please upgrade and try to install, I'm reasonably confident it will address your problem.

If it does not, feel free to open a new issue and reference this one and we'll dig more into it.