0

Enterprise v1.14.0.1 Nginx / php-fpm / Memcached

Any attempt to save a product in the admin panel results in:

  1. the ajax check comes back fine {"error":false}

  2. the request with all of the form data hangs, causes a php-fpm process to sit there and hang until timed out: 502 Bad Gateway

  3. there is not a corresponding mysql query that is hanging... it's as if the data is waiting to be transmitted to the db

  4. exception log, system log show nothing

  5. php-fpm log simply shows the disconnect

    [01-Jul-2014 11:51:24] WARNING: [pool www] child 10981 exited on signal 9 (SIGKILL) after 88731.019348 seconds from start

    [01-Jul-2014 11:51:24] NOTICE: [pool www] child 2599 started


Since turning on php-fpm debug logs and trying again, I get a bit more information:

[01-Jul-2014 12:29:36.906782] WARNING: pid 3144, fpm_request_check_timed_out(), line 281: [pool www] child 3410, script '/var/www/magento/index.php' (request: "POST /index.php") execution timed out (210.640298 sec), terminating
[01-Jul-2014 12:29:36.919687] DEBUG: pid 3144, fpm_got_signal(), line 76: received SIGCHLD
[01-Jul-2014 12:29:36.919842] WARNING: pid 3144, fpm_children_bury(), line 252: [pool www] child 3410 exited on signal 15 (SIGTERM) after 300.042214 seconds from start
[01-Jul-2014 12:29:36.921385] NOTICE: pid 3144, fpm_children_make(), line 421: [pool www] child 3527 started
[01-Jul-2014 12:29:36.921443] DEBUG: pid 3144, fpm_event_loop(), line 419: event module triggered 1 events

[EDIT: Correction to previous edit] We are NOT receiving any PHP errors. I've confirmed the PHP error log is working. (I previously reported we were receiving PHP errors... but it turns out these were from more than a week ago - and are unrelated)

Further investigation:

Although we are receiving an 502 Bad Gateway error (after the page hangs for several minutes), the product is saving the edited information. It appears that the response is not coming back to the browser after the DB update query has finished.


I've confirmed that the controller is hanging at $product->save(); in the file: magento/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php

/**
 * Save product action
 */
public function saveAction()
{
    $storeId        = $this->getRequest()->getParam('store');
    $redirectBack   = $this->getRequest()->getParam('back', false);
    $productId      = $this->getRequest()->getParam('id');
    $isEdit         = (int)($this->getRequest()->getParam('id') != null);
   $data = $this->getRequest()->getPost();
    if ($data) {
        $this->_filterStockData($data['product']['stock_data']);
        $product = $this->_initProductSave();
        try {
            Mage::log(__LINE__.' - commencing to save product');
            $product->save();
            Mage::log(__LINE__.' - completed saving');

What else can I look at to troubleshoot this? Thanks for any suggestions.

1

The cause was too many TargetRules (Rule Based Product Relations). The client added 150 target rules, and with their 10k products it ran too many target rule indexes after saving any product. This took much longer than the server was configured to handle, and ultimately timed out giving a 502 Bad Gateway error.

We're going to work with the client and Magento to come to a solution.

Thank you for your assistance.

|improve this answer|||||
0

PHP-FPM 502 Bad Gateway means that your PHP code encountered an error. Enable logging and see what your Magento system.log has to say. PHP-FPM is just a Gateway Interface, so its logs are basically next to useless once you get it up and running.

|improve this answer|||||
  • Thanks for your response - I've got all logging enabled (including log_level = debug in php-fpm) - and there are no exception.log or system.log entries when this happens. – Mark Middleton Jul 1 '14 at 16:42
  • Do you you have Magento logging enabled? It's disabled by default. – Pronto Jul 1 '14 at 16:49
  • Yep - system -> configuration -> developer -> Log Settings -> Enabled = Yes (and we use the logs regularly to troubleshoot other issues without any problem) – Mark Middleton Jul 1 '14 at 17:00
  • edited original post to show elaborated php-fpm logs – Mark Middleton Jul 1 '14 at 17:07
  • Check you phpinfo() to see where your PHP writes its logs. This is next place to check ... please note that PHP-FPM is NOT PHP, it's an interface for PHP – Pronto Jul 1 '14 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.